Posts by cemdorst • 758 points
25 posts
-
0
votes1
answer220
viewsA: How to execute commands from a Ubuntu executable in php?
You can write a script in expect and call it from your PHP code. Example: #!/usr/bin/expect set timeout 10 set alvo [lindex $argv 0] set modelo [lindex $argv 1] spawn ./needle $alvo $modelo expect…
-
3
votes3
answers1827
viewsA: Shell Script - compress one file at a time inside the Current Folder
I think the biggest problem here is the file/directory with white space. The command below searches for any file/directory from the current directory and executes tar with the desired parameters,…
-
0
votes1
answer60
views -
2
votes2
answers805
viewsA: How to define a global alias in BASH?
Put your aliases inside the archive /home/$USER/.bashrc . This file runs every time you open a graphical terminal. Preferably add your aliases at the end of the file. For example, you can use the…
-
7
votes3
answers666
viewsA: In bash, what is the difference between <, << and <<?
< Incoming redirect For commands waiting for an input (usually keyboard), you can redirect a file to the input (just like you did with the cat < index.php). Another example: nc -l 8888 <…
-
3
votes1
answer62
viewsA: How to access an environment variable with .(dot) in the name
Apparently this is not possible (in BASH). Only alphanumeric characters and underscores are allowed. export [-fn] [name[=word]] ... name A word consisting only of alphanumeric characters and under‐…
-
0
votes1
answer135
viewsA: How to increase the memory limit of a process?
You can use the command ulimit -v unlimited before calling the process. Also see if there are any restrictions in the file /etc/security/Limits.conf . This will clear the use of virtual memory.…
-
1
votes2
answers521
viewsA: Is there a way to set up a Domain Record in the.br registry for a particular URL folder?
The short, thick answer is: there’s no way to set this up in DNS. An elegant solution is to use virtual hosts on the web server.
-
1
votes2
answers501
viewsA: What is the way to configure VI to autocomplete and format the files in a standardized way according to each language?
There is the possibility of autocompleting existing words in your code from the vim 7 . You can use this function using the combination CTRL + n . To autocomplete reserved words of some already…
-
1
votes4
answers1578
viewsA: How to calculate the CPU percentage?
I’ll try to answer that question with an analogy. Imagine that you have to go from your house to the beach by taxi, and you are disputing this taxi with other people who also want to go to the…
-
4
votes2
answers532
viewsA: Advanced image optimization and compression on web servers without using external services
Dude, doing a search I found an answer in gringo stack. I think it can help you: pngcrush jpegtran With the option pngcrush -brute I got a reduction of ~20% in .png and with the jpegtran I got ~10%…
-
3
votes1
answer665
viewsA: Apply permissions after executing rsync command
If the files are not with the correct permission in the source and you are using the "-a" parameter (includes preserving permissions) the files will arrive at the destination with the permission of…
-
3
votes3
answers906
viewsA: Create file with run permission
If you use vim, this can be an automated solution: Add the next line to your ~/.vimrc: au BufWritePost * if getline(1) =~ "^#!" | if getline(1) =~ "/bin/" | silent !chmod +x <afile> | endif |…
-
2
votes2
answers199
viewsA: How to monitor a C code on Linux
1- You can use the top to monitor only one PID. Discover the program PID as the colleague suggested: ps -aucx|grep <nome do programa> I like to use the command below as it only lists children…
-
0
votes2
answers180
viewsA: Bash, know what board you’re running on
Perhaps a more general solution is: #!/bin/bash PROGNAME=$(basename $0) PROGDIR=$(readlink -m $(dirname $0)) This also works for directories with links.
-
0
votes2
answers472
viewsA: linux command - lock folder name/rename
If he owns the folder he will always be able to rename it, as he will also always be able to change the permissions of the folder. I suggest you change the folder owner to another user and put the…
-
0
votes2
answers129
viewsA: Why do my Virtualhosts point to the root folder.?
Possibly the directory is without permission, or as Bruno said, must be problem case sensitive in the name of your directory.
-
3
votes3
answers280
viewsA: How to Show the file path opened in VIM
Typo: :set statusline+=%F :set laststatus=2 Or, to leave permanent, put the lines below in your ~/.vimrc set statusline+=%F set laststatus=2 Source:…
-
2
votes2
answers757
views -
2
votes1
answer100
viewsA: Remotely access another Unix machine with Vim
The syntax is: vim scp://user@host//path_do_arquivo Don’t forget the two bars to declare the path complete. Source: http://vim.wikia.com/wiki/Editing_remote_files_via_scp_in_vim…
-
1
votes1
answer254
viewsA: What is the latest script running on Ubuntu server 14.04 LTS startup and in what file is it called?
The official Ubuntu document reads as follows:: What order are initscripts Started and stopped in? If a service has not been converted to upstart, this has not changed; the symlinks are named…
-
1
votes1
answer2588
viewsA: Mysql server cannot start in Centos
Your system seems to have crashed (not shut down in the correct way), and as a consequence, should not have deleted the mysql server lock file in a normal shutdown procedure. Delete the lock file…
-
1
votes1
answer271
viewsA: Send files via rsync setting user and group
Do what you want if you run the rsync from the target machine as root (sudo), preserving Owner and group of origin: sudo rsync -Crav user@origem:/dir/de/origem /dir/de/destino To solve the problem…
-
0
votes3
answers579
viewsA: Delete . bashrc, . bash_profile and . profile files: what are the consequences?
If you are using graphical environment and therefore only virtual terminals with Interactive shell, the .bash_profile should not be missed. Just like the .bashrc and the .profile which serve to…
-
2
votes2
answers406
viewsA: Error in bind server configuration
If you are not going to use dnsmasq (as suggested by Rafael), see the dns configuration of the client machines in the file /etc/resolv.conf . It should look like the below: search intranet.equilibra…