While monitoring a http/php server, I needed to do some statistics about php-cgi memory usage. Playing with memory_limit in PHP, we wanted to know the average memory usage per php-cgi process. This is easily calculated with our best friend awk. First, get the number of php running processes: # ps aux | grep php-cgi | …
Command line
The unix touch command
This post is a quick ref on the linux touch command. All the examples have been tested on Linux. This command is used to update the access and modification times of files. touch’s syntax touch [option] file_name(s) touch file1 file2 file3 Here some examples: # touch /tmp/file # ls -l /tmp/file rw-r–r– 1 charlybr charlybr …
Retrieve file from svn
Sometimes you need to retrieve a single file from SVN without doing a checkout on the repository. SVN provides the svn cat to output the content of a file. You can redirect the output to get the file as : svn cat https://svn.mydomain.com/project/folder/file.ext > file.ext You can also use a simple shell script to do …
Automatically set title on iTerm tabs
If like me you use iTerm for your terminal sessions, this is the tips to dynamically set the tab title. As I’m using the bash shell, the tab title can be automatically set with the PROMPT_COMMAND variable. You can set this variable in /etc/profile or in your .bashrc Mine is like this : export PROMPT_COMMAND=’echo …
Command line history
As read here, this is my command line history on my MacBook : [cc lang=”bash” line_numbers=”false”]$ history 1000 | awk ‘{a[$2]++}END{for(i in a){print a[i] ” ” i}}’ | sort -rn | head[/cc] [cc lang=”bash” line_numbers=”false”] 240 ssh 62 cd 55 scp 33 for 28 vim 25 ping 17 history 13 ls 4 sudo 3 telnet …