Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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.