Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With Ctrl + R you can search in previous commands. If you hit Ctrl + R again, it will displays older previous commands. The problem it that this search is "one way", it always displays older results each time you press Ctrl + R.

Right now, if I hit Ctrl+R too many times and miss the result I was actually looking for, I have to stop my search (Ctrl + G) and restart it from the beginning.

Is there any command (Ctrl + something ) to search for "newer" results than the one currently displayed?

share|improve this question
up vote 2 down vote accepted

Bash also has a forward history search, which is mapped to CtrlS.

Often, this shortcut will be masked by the stop flow control key binding for the terminal (check with stty -a). This will make your terminal stop outputting anything—not quite what you want.

To get forward history search working, you have two options:

  1. Disable the flow control altogether: stty -ixon

  2. Bind flow control to something else, e.g. to CtrlX with stty stop ^X

share|improve this answer
    
Thanks, exactly my problem. It works now. – j1b3 Feb 18 '13 at 11:11
    
NICE! why isnt that upvoted like a million times? – Leon Kramer Jul 3 '15 at 14:28

Ctrl + S should search the history "forward". Or whatever bind -p tells you is bound to forward-search-history.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .