Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

up vote 0 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

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.