How do I see what my most used linux command are?
I just saw this post on http://linux.byexamples.com/
Basically you use a simple one line awk script
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
A full explanation can be found at the link above.
Example of out put on my machine is:
1 211 21.1% ls
2 189 18.9% sudo
3 58 5.8% man
4 52 5.2% cd
5 43 4.3% ping
6 40 4% apropos
7 34 3.4% less
8 22 2.2% cat
9 18 1.8% which
10 18 1.8% aspell
awk '{print $1}' ~/.bash_history | sort | uniq -c | sort -n
The awk command will print the first string from ~/.bash_history (not showing command options or arguments), then sort will order all lines alphabetically, then "uniq -c" will remove duplicated lines (your typed commands) and count them, and the last sort will order your commands by the count number returned by uniq.
You can use the hash
command in your terminal, which keeps a hash entry of every command that you use along with the number of hits and based on the hits you can sort them out and process.
Check this article for more information.