Before you accept the loan Payday loans Enjoy a Little Spontaneity

Best shell tip ever: bck-i-search (or, reverse-i-search for the bash-heads)

So, you know that you can use ^R to search your command history, right? (Well, if you didn’t, now you do, go ahead, try it, it’s possibly the best shell tip EVER)

For the longest time I had no idea how to go forward, and ideally ^S should work but ^S is interpreted by zsh, or readline, or OS X Terminal (and perhaps ubuntu as well) as a way to stop input. (More here: https://bugs.launchpad.net/ubuntu/+source/bash/+bug/48880)

So, after some co-workers brought it up here yesterday, I googled and found this awesome post: http://nathanpowell.org/blog/archives/632 which shows you how to enable ^S by doing this:

stty stop undef

Once you do that, you can press ^R to search back and ^S to search forward.

I hope this delights you, as much as it delighted me.

PS. Of course you can always use a different keybinding for forward (^F) and backward search (^B), with zsh you can use:

bindkey ^F history-incremental-search-forward

bindkey ^B history-incremental-search-backward

but ^R and ^S just feel better to my muscle memory.

Leave a Reply