Server Fault is a question and answer site for system and network administrators. 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

I now can only select the last history command that matches.

How can I select,for example, the last but two command that matches?

share|improve this question

Pushing CtrlR repeatedly will find earlier matches.

share|improve this answer
Oh,never know this before!BTW, how can I switch to last but 1 from last but 2? – router May 15 '10 at 12:01
Switch to... what? – Ignacio Vazquez-Abrams May 15 '10 at 12:03
Switch to commands that has turned up before the current one, reversed ctrl r ? – router May 15 '10 at 12:06
You mean after? Ctrl-S does the opposite operation according to the man page, but terminals use Ctrl-S for flow control. – Ignacio Vazquez-Abrams May 15 '10 at 12:15
Yes.I just tried Ctrl-S,but seems no effect.. – router May 15 '10 at 12:19

Add this to your ~/.bashrc:

# allow ctrl-S for history navigation (with ctrl-R)
stty -ixon

You can enter that command at a prompt if you just want to try it out.

share|improve this answer

Your Answer


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