Skip to content

Instantly share code, notes, and snippets.

@wigsy
Created June 26, 2013 17:08
Show Gist options
  • Save wigsy/5869295 to your computer and use it in GitHub Desktop.
Save wigsy/5869295 to your computer and use it in GitHub Desktop.
ZSH alias for grep'ing the history command easily
# in your .zshrc add:
alias HG='history | grep '
# reload ZSH (using my default location as an example)
. ~/.zshrc
# Now run: ``HG something_of_interest`` and your history is grepped for said interesting something.
@kymtwyf
Copy link

kymtwyf commented Oct 13, 2015

very helpful

@olejorgenb
Copy link

This only greps the very last entries though? (history 0 fixes this)

@codewisdom
Copy link

I figured this out after someone showed me cat ~/.bash_history | grep Until now, I haven't been a big grep user... I spend way too much time in Windoze.

@cbilgili
Copy link

Thanks. I was trying like history | grep "$1". But your method is simpler

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment