3 ms·
Ctrl+r is fine when you're looking for something recent, but this one is useful when you're looking through a long list of similar commands. alias hist='hi
by wazoox 12y ago
Ctrl+r is fine when you're looking for something recent, but this one is useful when you're looking through a long list of similar commands.
alias hist='history | grep'
Use it like this:
$ hist git
9543 git add toto
9544 git commit
9545 git log
9546 git log
9548 git add -A
9549 git commit
9550 git log
9633 git pull
9955 cd dev/git
9957 git grep copyof
9958 git grep copyof
9959 git pull
By the way, do you know you can call back the 9633rd command in the history with "!9633"?
- hrrsn 12y agoWow, this is great. All too commonly I do cat ~/.bash_history|grep, but this is way easier. Thanks!
- WickyNilliams 12y agoI use this all the time. In fact it was one of the first aliases i made when i switched to a UNIX system. Though I named mine `greph` (for grep history). Absolutely invaluable