- history | grep command-name
- Press ctrl + r -> type the command.
I hope everyone is aware that hitting the arrow keys helps us navigate to recently executed commands but what if you forgot a command you used months before and want to use it now or view all the commands you used relating to git or docker. We will see three commands I often use to achieve this.
Press ctrl + r and start typing the command you knew you have executed months before. The terminal will autocomplete the command.
Example if you haven't used
ssh for sometime and feel lazy about looking the history, you could press ctrl + R and type ssh The terminal will autocomplete with your recent ssh command.
I have used ctrl + r then typed heroku. The terminal autocompleted with my most recent heroku command