m-ric m-ric - 4 years ago 228
Bash Question

How to reverse-i-search back and forth?

I use

reverse-i-search
often, and that's cool. Sometime though when pressing
Ctrl+r
multiple times, I pass the command I am actually looking for. Because
Ctrl+r
searches backward in history, from newest to oldest, I have to:


  1. cancel,

  2. search again and

  3. stop exactly at the command, without passing it.



While in
reverse-i-search
prompt, is it possible to search forward, i.e. from where I stand to newest. I naively tried
Ctrl+shift+r
, no luck. I heard about
Ctrl+g
but this is not what I am expecting here. Anyone has an idea?

Answer Source

There is a similar question here:

Control-r reverse-i-search in Cygwin bash: how do you "reset" the search?

Found another similar question on Super User:

http://superuser.com/questions/159106/reverse-i-search-in-bash

Apparently, both mention Ctrl+s, which may do the trick.

Hope that helps. I myself am trying to find a piece of code that does the reverse-i-search in order to check how it has been implemented exactly.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download