Creative Commons License

Articles tagged “shell”

What does your .bash_history say?

A friend of mine told me that on techie blogs there is a new meme going on: show off the most used commands, starting from shell history:


history | \
 awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | \
 sort -rn| head -15

I’ve got 20 times the default bash history size (10k lines), so it’ll yield interesting results. I also use the history timestamp feature, so I’ve added a little sed to the code in order to strip timestamps out.

Let’s see:


 13:19:50 vjt@voyager:~/code*$* history | 
     sed 's#^[ 0-9\[\/\:]*\]\([^ ]*\).*#\1#' |  
     awk '{a[$1]++}END{for(i in a){print a[i] " " i}}' | 
     sort -rn | head -15
928 l
577 ssh
389 ping
381 cd
300 dig
259 telnet
153 sudo
126 ifconfig
125 whois
113 ps
96 svn
91 cat
73 fg
68 vi
61 ..

yeah, I do a LOT of ls, l is actually ls -alFGs (I’m on Darwin). This list exposes my recent habits, because I’m coding less and managing more (no gcc, no irb, lots of dig & whois). svn is still there, of course ;). ssh means that these results should be aggregated with other histories coming from the other boxes I log on to.. but that’s a topic for anoter post ;).

Which are your results?

Post them here! :D

UPDATE 2008-06-03

As my recent habits are more coding than writing docs, I re-ran the history analysis.. and these are the new results:

1796 l
981 svn
705 ssh
693 cd
666 ping
402 vi
356 ifconfig
352 telnet
321 dig
315 sudo
283 fg
240 grep
188 ..
183 cat
157 ps

UPDATE 2009-02-20


5427 l
4379 git
3128 svn
2812 vi
2105 cd
1408 ping
1392 fg
1328 ssh
935 ifconfig
893 grep
890 sudo
733 rake
653 cat
554 ..
535 ruby

UPDATE 2009-05-24


7374 l
5041 git
3265 vi
3131 svn
2753 cd
1881 ssh
1763 ping
1618 fg
1101 sudo
1100 ifconfig
977 grep
867 cat
767 rake
721 telnet
671 ..
Posted at 20PM on 06/03/08 | 4 comments | Filed Under: number 42

About

This is sindro.me, a weblog by Marcello Barnaba (vjt) about technology, ruby, development, software, the internet, entertainment, politics, sociology, and the answer to Life, Universe, and Everything (42).

Links