Meme

Picked up a meme from here, may as well spread it around.

~ $ history|awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
2394 cd
1879 ls
1017 vim
998 sudo
890 bzr
732 ruby
585 rm
538 mv
493 find
412 svn

The only reason vim is so low is because I usually start gvim from my KDE menu. Sudo is in that list because my .bash_history stretches back through my Ubuntu phase almost a year ago. At some point I should probably clean out my history file.

Tags: ,

4 Responses to “Meme”

  1. Quoth Ivar Refsdal:

    Pretty nice. I added this for fun:

    history|awk ‘{a[$2]++; total++ } END{for(i in a){print a[i] ” (” (a[i]/total)*100 “%) ” i}}'|sort -rn|head

    191 (38.2%) ssh
    74 (14.8%) ping
    46 (9.2%) ls
    37 (7.4%) cd
    24 (4.8%) ./goslime
    13 (2.6%) vim
    12 (2.4%) exit
    9 (1.8%) ./gogo
    8 (1.6%) python
    7 (1.4%) /bin/sh

    I did a different awk one-liner here.
    Cheers :)

  2. Quoth Ivar Refsdal:

    Hmm.. Maybe this will work better?

    history|awk ‘{a[$2]++; total++ } END{for(i in a){print a[i] ” (” (a[i]/total)*100 “%) ” i}}'|sort -rn|head

  3. Quoth Ivar Refsdal:

    Nopes. Double and single quotes "s are still broken.

  4. Quoth Ivar Refsdal:

    history|awk '{a[$2]++; total++ } END{for(i in a){print a[i] " (" (a[i]/total)*100 "%) " i}}'|sort -rn|head

    Hopefully that works…

Leave a Reply

You can use these tags in comments (Note: HTML is automatically escaped inside <pre> tags, nowhere else, so if you post source code, put it in <pre>):

<pre lang="some_programming_language"> 
<em>
<strong>
<a href="url">

NOTE: Comments are automatically spam-filtered. If your comment fails to appear, it was likely munched by the filter. Try not to link-spam or post anything that looks like it was typed by a robot.