Find 50 most used commands on machine
I am very fond of the history command, and I like to grep old commands from it. Saves me a lot of time. I was wondering what commands i have actually used the most - I found these with the following awk-based script, which will generate a fine list for you:
$ 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 -n50
Output (2 months old, local machine)
1 888 17.7636% ls
2 732 14.6429% ssh
3 480 9.60192% cd
4 438 8.76175% vi
5 381 7.62152% dig
6 227 4.54091% clear
7 187 3.74075% cat
8 132 2.64053% python3
9 91 1.82036% sudo
10 81 1.62032% ping
11 74 1.4803% vagrant
12 74 1.4803% rm
13 67 1.34027% git
14 66 1.32026% curl
15 64 1.28026% telnet
16 47 0.940188% mtest
17 45 0.90018% whois
18 42 0.840168% brew
19 40 0.80016% python
20 38 0.760152% scp
21 36 0.720144% nc
22 35 0.70014% p3
23 31 0.620124% mv
24 31 0.620124% grep
25 27 0.540108% netstat
26 27 0.540108% man
27 24 0.480096% history
28 23 0.460092% sass
29 21 0.420084% bash
30 19 0.380076% pip
31 19 0.380076% g++
32 18 0.360072% vim
33 18 0.360072% clear;
34 18 0.360072% awk
35 17 0.340068% ps
36 17 0.340068% open
37 16 0.320064% wget
38 16 0.320064% chmod
39 15 0.30006% mkdir
40 11 0.220044% ifconfig
41 9 0.180036% tshark
42 9 0.180036% traceroute
43 8 0.160032% netcat
44 8 0.160032% jobs
45 8 0.160032% htop
46 8 0.160032% fab
47 8 0.160032% cp
48 7 0.140028% pwd
49 7 0.140028% atom
50 6 0.120024% top