Bash – Searching history in Bash forward after backward

bashcommand history

In Bash, when I hit Ctrlr, I can search the command history backward. If I would like to search forward again, what shall I do?(The Ctrls doesn't work.)

My Bash is: GNU bash, version 4.2.25(1)-release (i686-pc-linux-gnu)

Best Answer

Your tty probably has the ixon and ixany bits set.

ixon enables XON/XOFF flow-control, so when you hit CtrlS, the tty device stops output. But ixany means that any other key will restart output, so most people don't notice it ever stopped.

Some people find flow-control useful, but you can disable it by running:

stty -ixon

and then CtrlS should work as expected for searching in bash.

You might want to add that to your ~/.bashrc!

Related Question