Tag Archives: awk

Analyze history for most used commands

With history and a little bit of awk we make the magic. List commands in history by usage. Two examples above, the simple one and the advanced where the arguments to the commands are shown.

 bash | 
 
 copy code |
?

1
2
 

 bash | 
 
 copy code |
?

1
history  | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
2
3
4
#Advanced version