2009-08-04

Command History

Spotted on an old post from an abandoned blog out in the geek hinterlands, but I figured I'd have a go.

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

Got that?

Well, I work on quite a few machines, but there are two major Linux accounts I use: my networked (NIS) account and the separate account on my desktop box. So, desktop first...

  110   ssh
   76   ls
   73   td
   48   cd
   47   svn
   38   vim
   16   grep
   10   ping
    9   pushd
    9   less

As you can see, I ssh out quite a lot. 'td', by the way, is a little script I use for managing a to-do list.

And the network account...

  192   sudo
  171   ls
   68   glite-wms-job-status
   48   cd
   42   cat
   41   rm
   35   for
   34   history
   19   firefox
   18   man

So I sudo a lot — I'm an admin, what can I say? The 'glite' command is a grid operation from when I send test jobs out to exercise parts of our cluster (and most of the 'for' commands are sending out test jobs). Amazing how often I trawl history too! The 'firefox' invocations are mostly from yesterday when I was trying to work out why weird things were happening. But that's another story.

Of course, the number of concurrent sessions I have open on both of these accounts does distort the history a bit, but it's still interesting for me to see what I get up to!

No comments: