v1t0kq
Last Updated: February 25, 2016
·
1.463K
· eallam
Ericprofilenew

Reverse search your bash history

You know in your shell how you can hit the up arrow and cycle back through your old submitted commands? You can also get a list of your shell history using the history command, like so:

$ history
1  gs
..snip a bunch of lines..
814  heroku ps
815  heroku ps:scale worker=1
816  gs
817  history

Combine that with grep to search for past commands:

history | grep heroku

Or you can just hit CTRL-r and start typing to search and then hit Return to run the intended command:

Picture

Say Thanks
Respond

1 Response
Add your response

3824
Eea09ae62533e44d90e78edfd64a43d2

Alternatively you could place in your ~/.inputrc the lines

"\e[A": history-search-backward

"\e[B": history-search-forward

This way you can type a partial command and press arrow keys to go through your history.

over 1 year ago ·