Enabling Ctrl-S for forward-history-search in bash

Ctrl-R and Ctrl-S are advertised in every readline command-line to do backward and forward search in your command history (as emacs does on text with the same shortcuts).

And you've probably come to the fact that if Ctrl-R is working (and you use it every day), Ctrl-S doesn't seem to work and freezes the screen. So you've just learned not to use Ctrl-S.

readline based command-line program (as any unix shell) will answer to Ctrl-S if they receive the keystroke. The keystroke Ctrl-S actually does not reach readline because it's caught by the TTY driver. TTY driver will trigger a pause in the reception of characters upon Ctrl-S keystroke, and this is why the screen appears to freeze. You can unfreeze with Ctrl-Q.

This pausing mechanism is from old times when you could ask for other end to pause sending characters. This was meant to prevent character loss. With nowadays hardware, this is not useful anymore, and you can safely de-activate this obsolete feature to enable back Ctrl-S in your readline based command-line with:

stty stop ''

Note that you can put this in your ~/.bashrc if needed.