Monday, November 12, 2007

My favorite shell commands

The below one line shell script calculates the number of executions of commands and sorts the result.

history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -rg

Here is the result of this script on my Ubuntu.

66 ls
40 cd
32 sudo
32 mvn
31 ps
29 clear
26 more
22 vi
19 tail
18 kill
16 ssh
13 rm
13 eclipse
10 ll
10 find
9 locate
9 findJar
6 ifconfig
5 ln

Most frequently used command is "ls". I was surprised to see "mvn" in the 4th place. As you can see I am developing (eclipse), testing-packaging (mvn) and deploying ( web applications written in java these days. I have also "kill"ed a serious number of processes :)

Try this script to see what commands you use frequently.