You can enable the ‘Up’ arrow of your keyboard to search through commands that you have used in the past, on the terminal. Just type the initial few letters of the desired command and press ‘Up’ arrow, and you will get the commands that start with the letters you have typed.
To enable this search, you have to add the following lines at the end of your .bashrc file, which is stored in your home directory.
$bind ‘”e[A”: history-search-backward’
$bind ‘”e[B”:history –search-forward’
And them run thye following command:
For example, if your bash history contains the following:
And if you want to search for a python2.7 command, then enter ‘py’ and press ‘Up’ arrow. The terminal will show commands that start with py, one at a time. You can keep pressing the ‘Up’ arrow to search until the terminal shows the desired command.