pravi@savannah:~$ history|awk ‘{print $2}’|awk ‘BEGIN {FS=”|”} {print $1}’|sort|uniq -c|sort -r|head -10
9 qemu
91 cd
8 free
8 du
87 ls
7 export
7 cat
6 ssh
6 pdftohtml
5 man
Thanks Karthik for that tip.
The above script doesn’t give the “most used” commands – as you can see 9 appears above 91.
A slight modification does the trick:
$ history | awk ‘{print $2}’ | awk ‘BEGIN {FS=”|”} {print $1}’ | sort | uniq -c | sort -rg | head -10
i.e. instead of sort -r, use sort -rg which does a numeric sort.
–Das
Das,
Thanks a lot for the tip.