r/UnixProTips • u/ARCH_LINUX_USER • Feb 05 '15
Check the top 10 commands you use
history | awk '{CMD[$2]++;count++;}END { for (a in CMD)print CMD[a] " " CMD[a]/count*100 "% " a;}' | grep -v "./" | column -c3 -s " " -t | sort -nr | nl | head -n10
30
Upvotes
5
u/RayLomas Feb 05 '15 edited Feb 05 '15
A quick and dirty way for similar stats, first 25 + doesn't depend on bash, so should work in any shell:
I don't keep my history for long, so that's for me:
(edit: added line numbers)
4
u/[deleted] Feb 05 '15
very nice, thanks! ;)
2
u/kitute Feb 05 '15
number one here is sudo with 74% :) by the way, this does not work in csh, only in bash.
2
u/Orange_Tux Feb 07 '15
2
u/fraunhofer92 Feb 07 '15
1
u/for-loop Feb 18 '15
cool stuff, thanks!