pstree - lists processes in a tree format, I find this very useful for when working with heavy duty applications, and applications that spawn other processes:
[ ~ ]
[ alex@server ] pstree
init-+-crond
|-dhclient
|-httpd---14*[httpd]
|-mingetty
|-mysqld_safe---mysqld---9*[{mysqld}]
|-ntpd
|-perl
|-rsyslogd---2*[{rsyslogd}]
|-screen---bash---irssi---figlet
|-3*[screen---bash---irssi]
|-screen-+-bash---irssi
| `-bash
|-2*[screen---bash]
|-sshd-+-3*[sshd---sshd---bash---screen]
| `-sshd---sshd---bash---pstree
|-svnserve
|-udevd
`-znc
pgrep - lookup processes based on name or other attributes
To list all process id’s owned by root, we could:
# ps -ef | egrep '^root ' | awk '{print $2}'
1
2
96
187
2053
...
Or we could:
# pgrep -u root 1 2 96 187 2053 ...
split - for splitting a larger file into manageable chunks
[ bbc.closing.sites.archive ] [ alex@server ] ls -al drwxrwxr-x 3 alex alex 4096 Apr 19 19:58 . drwxrwxr-x 3 alex alex 4096 Apr 5 19:55 .. -rw-rw-r-- 1 alex alex 916635648 Feb 10 15:04 bbc.co.uk.tgz [ bbc.closing.sites.archive ] [ alex@server ] split -b 128m bbc.co.uk.tgz bbc.co.uk.tgz_ [ bbc.closing.sites.archive ] [ alex@server ] ls -al -rw-rw-r-- 1 alex alex 916635648 Feb 10 15:04 bbc.co.uk.tgz -rw-rw-r-- 1 alex alex 134217728 Apr 19 19:58 bbc.co.uk.tgz_aa -rw-rw-r-- 1 alex alex 134217728 Apr 19 19:58 bbc.co.uk.tgz_ab -rw-rw-r-- 1 alex alex 134217728 Apr 19 19:58 bbc.co.uk.tgz_ac -rw-rw-r-- 1 alex alex 134217728 Apr 19 19:58 bbc.co.uk.tgz_ad -rw-rw-r-- 1 alex alex 134217728 Apr 19 19:58 bbc.co.uk.tgz_ae -rw-rw-r-- 1 alex alex 134217728 Apr 19 19:58 bbc.co.uk.tgz_af -rw-rw-r-- 1 alex alex 111329280 Apr 19 19:58 bbc.co.uk.tgz_ag
nl - number the lines and output to stdout
[ bbc.closing.sites.archive ] [ alex@server ] nl bbc.closing.sites.archive.txt | head 1 On Monday 24th January 2011 the BBC announced [1] that it would be 2 restructuring its online department - with 360 job losses and the 3 deletion of 200 of its top level directories (including the websites 4 that live under them - eg http://www.bbc.co.uk/blast). 172 of of those 5 top level directories [2] are due to be deleted within the coming 12 6 months. 7 Most of these sites are already 'mothballed' [3], which means that the
xmlwf - check whether an XML file is well formed
[ ~ ] [ alex@server ] curl -s 'http://millsie.net' > index.html [ ~ ] [ alex@server ] xmlwf index.html index.html:387:154: not well-formed (invalid token)











If you find yourself constantly using `cat` instead of `nl`, learn to use the ‘-n’ option which will do much the same.
At first I wondered why one might use xmlwf over xmllint, but xmlwf seems to be a simpler tool simply for checking the formation of XML.
`cat -n` might be a better solution overall – `nl` seems to not count blank lines, whereas `cat -n` does
pv – monitor the progress of data through a pipe
i.e. `pv sqlfile | mysql dbname` will display the current progress of the execution of the sql file, very nice for big db imports
pmap – report memory map of a process
i.e. `pmap -x ` excellent way of analysing what’s in memory for a given process, also the starting point if you want to dump the running memory (getting the start address).
nc – arbitrary TCP and UDP connections and listens
not used as often as I’d like to see it being, I much prefer this over telnet myself. to many uses to list them all, especially when combined with a pipe.
inotifywait – wait for changes to files using inotify
very handy for quickly seeing the activity on a file / folder via stdout, you should of course use auditctl if you want more detail.
i.e. inotifywait -m –timefmt “[%a %b %d %H:%M:%S %Y]” –format “%T [%e] %f” -r /folder/to/watch
mkfifo – make FIFOs (named pipes)
Seemingly innocent and unexciting by itself, combine it with something like netcat for “magic” (such as a transparent RTMP proxy hack I setup back in February)
I’ll stop now, the list as you know is massive
Nice topic – respect !