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:
Written by Eric Allam
Related protips
1 Response
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
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#