We Recommend

bash Cookbook: Solutions and Examples for bash Users bash Cookbook: Solutions and Examples for bash Users
bash Cookbook teaches shell scripting the way Unix masters practice the craft. It presents a variety of recipes and tricks for all levels of shell programmers so that anyone can become a proficient user of the most common Unix shell -- the bash shell -- and cygwin or other popular Unix emulation packages.


Posted By

noah on 05/06/08


Tagged

time history awk reporting logging metrics sousveillance


Versions (?)


Who likes this?

1 person has marked this snippet as a favorite

srinivasga


List commands in history, sorted by usage


Published in: Bash 


URL: http://benstraw.com

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

Report this snippet 

You need to login to post a comment.