Saw a few others on Planet Mandriva doing this so I figured what the heck, I’d do the same. I don’ t use bash tho, I use zsh and on one box I have the extended history saved (timestamps), and the other I don’t. Also keep in mind that I do a lot of stuff via sudo (so for instance, urpmi wouldn’t show up because it’s being called from sudo), and a lot of my work is in chroots so the “host” shell doesn’t get that history.

Anyways, on my main desktop:

vdanen@odin:~/ >% cat ~/.zsh_history|cut -d ';' -f 2- 2>/dev/null|\
awk '{a[$1]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head 
493 ls
465 joe
372 ssh
313 cd
244 scp
243 svn
171 rm
122 exit
107 cat
89 grep

and on the updates build box:

vdanen@titan:~/ >% cat ~/.zsh_history|\
awk '{a[$1]++ } END{for(i in a){print a[i] " " i}}'|sort -rn|head
825 ls
674 exit
668 sudo
659 qa
604 svn
560 cd
468 joe
267 cve
225 cp
174 rm

It gets more interesting once you move past the top 10… using head -20 is more interesting, of course.

Share on: TwitterLinkedIn

Related Posts





Stay in touch