What commands do you run?

People have been posting in their blogs about what command they run, based on their shell histories. The command that I've seen looks like this:

history|awk '{a[$2]++} END{for(i in a){ \
printf "%5d\t%s \n",a[i],i}}'|sort -rn|head

That works, of course, but who wants to use awk and the shell? I pulled out the old Data::Hash::Totals module I wrote a while back, along with Perl's built-in awk simulation:

$ history | perl -MData::Hash::Totals -ane'$x{$F[1]}++;' \
-e'END{print as_table(\%x, comma => 1)}' | head
207 vim
143 svn
125 make
 90 ack
 77 cd
 45 sdvx
 34 ssq
 31 ls
 25 ./login-fixup
 19 tail

alester:~ : cat `which sdvx`

svn diff -x -w $* | view -
and ssq is just an alias for svn status -q.



Chris Dolan said:

For tcsh, you have to pull the third column instead of the second column for the default output of history...

My top five are:

101 fg
50 make
34 svn
32 perl
19 cd

I run a single, long-lived instance of emacs with dozens of buffers. I routinely Ctrl-Z to halt it, run a command, and fg to resume it.

jdv said:

305 ant
122 cd
119 vim
95 svk
71 ls
70 ssh
55 svn
51 grep
15 rm
11 p

I've been doing a lot of flex work lately; that's the ant. I think the p is from my ctrl key not working when trying to rapidly run a command in the recent history. Otherwise not too surprising to me.

Leave a comment

About this Entry

This page contains a single entry by Andy Lester published on April 16, 2008 10:31 AM.

Google now returns code snippets was the previous entry in this blog.

The case of the blocking CREATE INDEX call is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Other Perl Sites

Other Swell Blogs

  • geek2geek: An ongoing analysis of how geeks communicate, how we fail and how to fix it.