11

When doing reverse intelligent search on a terminal (Ctrl+R), I can keep pressing Ctrl+R to go back in "history" and get older commands containing my search string.

How can I move back to a result which I have already displayed (a previous search result)?

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Vincenzo Pii
  • 18,961
  • 8
  • 39
  • 49
  • 2
    Your question belongs on SU, where it [has been answered](http://superuser.com/a/159184) already. – Ansgar Wiechers Jul 20 '13 at 09:38
  • 2
    @AnsgarWiechers Funny that the accepted answer to that question on SU links a question on SO... Reverse-i-search IS a tool for developers. – Vincenzo Pii Jul 20 '13 at 09:41
  • So eventually this has answer: http://stackoverflow.com/questions/549810/control-r-reverse-i-search-in-cygwin-bash-how-do-you-reset-the-search/549860#549860 – anubhava Jul 20 '13 at 10:21
  • @VincenzoPii no. reverse search is a feature of a shell. The shell is a tool _used by_ developers. And, yes, it _is_ funny that [SU] links to [SO] for that answer :/ (+1) – sehe Jul 21 '13 at 10:25

1 Answers1

29

I want to leave a reference for people who may find this, as the linked question actually asks for something else (even if one of the answers contains the solution to this problem).

The key binding to move forward is CTRLS.

The problem is that this binding, in many terminals, is used by default to send the pause transmission code (XOF).

As in man stty:

   [-]ixon
          enable XON/XOFF flow control

So, if you have this option enabled on your terminal (the output of stty -a contains ixon withouth the - sign in front), you cannot use CTRLS in the context of reverse-i-search.

To disable it, use the following command:

stty -ixon

And CTRLS will give you a (i-search) (non reverse).

Community
  • 1
  • 1
Vincenzo Pii
  • 18,961
  • 8
  • 39
  • 49