Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

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?

I hit Ctrls, but it doesn't work.

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

share|improve this question
Ctrl-S should work. At least it works on my machine in an xterm. If this doesn't work, type stty -ixon. – vinc17 Jul 8 '14 at 22:24
Does your shell lock-up with ctrl-s, and recover with ctrl-q? If so you need to disable flow control. (tell us if it does, so we can give the correct help) – richard Jul 8 '14 at 22:26
With flow control, Ctrl-S stops the flow, while Ctrl-Q re-enables it; that's why it solves your problem. Flow control is useless nowadays. I suggest that you disable it with stty -ixon (put that in your shell startup file for interactive shells). – vinc17 Jul 8 '14 at 22:44
2) you can only go forward, after going backward: you can not do forward to what you will type later, the computer is not clever enough to figure this out. – richard Jul 8 '14 at 22:45
Flow control was used to pause the output, useful if the computer outputting to fast, but not so fast that you can not see roughly where it is. These days it is useless, as the computer is way to fast to make it useful. (a bit of software could be fast enough to react, so it could be used there. Other flow control protocols are used in TCP for example) But the short story is that if you disable it, you will not miss it. – richard Jul 8 '14 at 23:04

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!

share|improve this answer

Your Answer


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.