Posted By

noah on 05/06/08


Tagged

time history awk reporting logging metrics sousveillance one-liners


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

srinivasga
naesk


List commands in history, sorted by usage


 / Published in: Bash
 

URL: http://benstraw.com

Lists the top 10 commands in your history file.

Thanks Ben!

Here's an example session:

May12 10:39:18 book> ~/Documents/n_s/tools/command-history.sh
162 quite
110 svn
107 ruby
61 curl
39 rwget
34 grep
33 cd
21 lwp-request
19 fg
17 ls
  1. history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
  2.  
  3. # Full sousveillance version:
  4. history | awk '{a[$2 " " $3 " " $4 " " $5]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head -n+25

Report this snippet  

You need to login to post a comment.