Here is a little awk hack for linux command history

If you are using a Linux distro and you use the command line a lot,  this little awk trick will show you your most used commands so that you can create aliases for them leading to an increase in your productivity using the command line.

Here is the snippet:

A few notes here:

1- I set the FS as 2 spaces since there are 2 spaces after the line number in the output of the history command

2- I use a final awk pipe so that I only display the commands that have been used more than once.

Now you can create your aliases and work faster on your Linux command line.

NOTE:

You can take better advantage of this if you have a long history.
To extend the length of the history in your terminal, add the following to your .bash_profile:

HISTFILESIZE=1000000000
HISTSIZE=1000000

 

Hope this helps.
Good Luck,
Serdar