Have you ever been curious what commands you use most in Linux shell?
The following command helps you do just that.
1 |
history | awk '{if ($2=="sudo") {CMD[$3]++;} else {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 -n20 |
My Result:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
1 383 18.8577% ls 2 356 17.5283% git 3 314 15.4604% cd 4 79 3.88971% apt-get 5 56 2.75726% rm 6 50 2.46184% service 7 48 2.36337% history 8 40 1.96947% ssh 9 40 1.96947% nodejs 10 35 1.72329% nslookup 11 31 1.52634% npm 12 28 1.37863% cat 13 27 1.32939% man 14 27 1.32939% ifconfig 15 26 1.28016% mv 16 23 1.13245% ping 17 20 0.984737% find 18 20 0.984737% cp 19 15 0.738552% mencoder 20 15 0.738552% exit |
P.S. this is modified from what is your 10 common linux commands? » Linux by Example and I changed it to expand command that starts with “sudo”.
Do share your interesting findings here:)