4 ms·
ctrl + r Starts a search through your history file.
by bohr99 17y ago
ctrl + r
Starts a search through your history file.
- bingaman 17y agoThis works because you're in emacs mode, which gives you a bunch of other tasty shortcuts (http://www.scribd.com/doc/985254/Bash-Emacs-Editing-Mode-readline-Cheat-Sheet http://www.scribd.com/doc/985254/Bash-Emacs-Editing-Mode-rea...) as well. There is an equivalent vi mode as well ("set -o vi").
- lzell 17y agoand crl+r again for the next match. The ctrl+o tip didn't work for me though (OS X).
- Isomer 17y agoAnd then ^o to execute that command, and put the next command from your history onto the command line ready for another ^o...
- alexkay 17y agoThank you so much! No more `history | grep cmd` %)
- uggedal 17y agoMap <up> and <down> to do the same in .zsh: # search history on <up> key instead of paging previous commands: bindkey "\e[A" history-search-backward bindkey "\e[B" history-search-forward
- apu 17y agoOr in bash, using .inputrc (readline): "\e[A": history-search-backward "\e[B": history-search-forward