History is a great command to use, I use it daily, today I have found a real good application of it.
It is the way to list the most used commands by you.
Here is how, type this in the console:
history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort -r
What this command does is to pass the output of history to awk, which prints only the second column of it, then it sorts it and count the occurrences of each command, finally it sorts the output in reverse order, so you have first your most used command and at last the least used one, if you want the opposite order try this one:
history|awk '{print $2}'|awk 'BEGIN {FS="|"} {print $1}'|sort|uniq -c|sort
You can use history also with grep, if you want to look for an specific command like:
mount 192.168.1.1:/home/user /media/nfs
Which is too long to type again, and you may not remember it, so you can look for it using:
history | grep mount
but if you use it or other command a lot, is better to create an alias for it.
This article is inspired, and with info from: LifeHacker







Lets use awk associative array for the count task
$ history | awk '{print $2}' | awk -F "|" '{c[$1]++}END{for(j in c) print c[j],j}'
http://unstableme.blogspot.com/2008/05/associative-array-in-awk.html
history | awk '{print $2}' | awk -F "|" '{c[$1]++}END{for(j in c) print c[j],j}' | sort -n
so you can have the most used command at the end. thanks again. Guillermo Garron