I rely on command history a *lot* and I was curious to know which commands I use the most. I found this on Reddit, and the results are interesting. You might have to tweak the command a bit to suit your shell.
$ history | awk '{CMD[$4]++;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 1 1697 17.5491% git 2 1309 13.5367% cd 3 673 6.95967% flamel 4 520 5.37746% find 5 443 4.58118% vi 6 322 3.32989% ll 7 300 3.10238% rm 8 283 2.92658% grep 9 279 2.88521% exit 10 277 2.86453% history
So which commands use up your day?
1 4784 47.9311% git
2 1758 17.6135% cd
3 1039 10.4098% ls
4 756 7.57439% ccutil
5 145 1.45276% sudo
6 145 1.45276% ssh
7 140 1.40267% more
8 113 1.13215% vi
9 110 1.10209% ansible-playbook
10 74 0.741409% mv
1 3816 44.6629% ssh 2 1543 18.0595% exit 3 325 3.80384% scp 4 307 3.59316% ls 5 204 2.38764% ping 6 199 2.32912% cd 7 197 2.30571% sudo 8 170 1.9897% for 9 140 1.63858% vim 10 117 1.36938% sedI now wonder if I should used Alt+F4 more often.
1 259 25.9259% git
2 176 17.6176% ssh
3 141 14.1141% vim
4 125 12.5125% cd
5 74 7.40741% ls
6 54 5.40541% ansible-playbook
7 32 3.2032% ssh-copy-id
8 23 2.3023% cp
9 18 1.8018% ssh-add
10 16 1.6016% less
Nice. : )
1 240 24% ssh
2 175 17.5% ls
3 108 10.8% cd
4 83 8.3% ping
5 68 6.8% vim
6 30 3% sudo
7 30 3% git
8 19 1.9% df
9 17 1.7% host
10 16 1.6% ip
Being a beginer to RHEL I use
1 588 58.8%
2 39 3.9% install
3 24 2.4% smbd
4 10 1% vsftpd
5 10 1% dlib
6 9 0.9% face_recognition
7 7 0.7% samba
8 6 0.6% new.jpg
9 6 0.6% arduino
10 5 0.5% smb
The HISTSIZE environment variable still set at the default of 1000, so my results are likely scoped on what I was last working on :-).
------------------
1 191 19.1% ls
2 190 19% docker
3 132 13.2% cd
4 58 5.8% sudo
5 49 4.9% ssh
6 46 4.6% nmcli
7 33 3.3% cat
8 30 3% vi
9 30 3% ping
10 22 2.2% ip
------------------
I have to replace `$4` with `$2` in my Fedora system. It goes like:
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
1 2087 20.7703% ls
2 1648 16.4013% cd
3 940 9.3551% vi
4 479 4.76712% cat
5 450 4.4785% git
6 402 4.0008% sudo
7 311 3.09514% grep
8 306 3.04538% ssh
9 260 2.58758% clear
10 251 2.49801% mv
don't know about most common command, but here's my most common 2nd arguments...
bowe ~ history | awk '{CMD[$4]++;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
1 720 72%
2 37 3.7% -n
3 27 2.7% user-lab
4 17 1.7% -t
5 17 1.7% grep
6 8 0.8% .
7 7 0.7% do
8 6 0.6% fixture
9 6 0.6% -d
10 6 0.6% config
Like others, I tend to do a lot of work remotely on multiple machines, so I don't know that this is really indicative for me, but it's fun. I'm also on a Mac with zsh, so I used Hightechredneck's variant one-liner:
1 146 15.1295% ls
2 128 13.2642% kubectl
3 86 8.91192% vi
4 57 5.90674% cd
5 46 4.76684% oc
6 37 3.8342% mctl
7 35 3.62694% pwd
8 30 3.10881% terraform
9 24 2.48705% ansible-playbook
10 23 2.38342% ssh
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.