Skip to content

Latest commit

 

History

History
18 lines (13 loc) · 688 Bytes

search-terminal-history-easily.md

File metadata and controls

18 lines (13 loc) · 688 Bytes

Search terminal history easily

The history command within Linux is super useful displaying all your recently run commands for your current user:

Running history produces an output like:

 1004  git add .
 1005  git commit
 1006  git status

Running ! followed by the number in the history will re-run the command, all this is great but sometimes your history is huge, rather than piping and grepping your history all the time instead you can place this handy function in your .bashrc file:

h () { history | grep $1; }

This means now you can run h SEARCH_TERM and you'll get a filtered list of items from your terminal history that match the search term.