Super User is a question and answer site for computer enthusiasts and power users. 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 usually end up using CTRL+r for (reverse-i-search), however, sometimes I pass the command that I was looking for; if I do again a (reverse-i-search) it doesn't find it anymore. I assume that the current pointer to the command history is before the command I'm looking for.

Does anybody knows how to go back to the most current command in the history without having to click 1000 times the down arrow?


share|improve this question
The reverse search is a feature of bash (and the readline libaries), so I've edited the title and question a little to reflect that. – Doug Harris Jul 1 '10 at 19:56
if you go past the command you wanted, do CTRL+SHIFT+R to go back – Ricky Robinson Mar 7 '14 at 17:18
up vote 4 down vote accepted

There's a similar question on

The best answer there is to use Ctrl+G to cancel the current search.

share|improve this answer
This really is not the best answer. The best answer is the one given by Dennis Williamson: add stty -ixon in your .bashrc (or in some other corresponding config file), and then Ctrl-S steps forward in history, similarly as Ctrl-G steps backward. First Ctrl-S keypress after Ctrl-G changes reverse-i-search to i-search, the next Ctrl-S takes the first step forward. Then each Ctrl-S takes one step forward more. – nrz Jun 8 '14 at 9:54
or if you already terminated the search (e.g. by hitting esc or an arrow-key), you can hit Esc followed by '>' – Superole Feb 24 '15 at 16:47

Actually, another answer to that question gives a better option.

In your ~/.bashrc add the following line:

stty -ixon

Then you can use Ctrl-s to step forward through the history in the same way as you would use Ctrl-r to step backward.

This will even work to start a new forward search (called i-search as opposed to reverse-i-search) while browsing through history. Suppose you do Ctrl-r and type some text of a command near your destination then press up arrow several times overshooting what you were really looking for (or you change your mind). Now press Ctrl-s and type a few characters from that line. Zoooom! Straight to it.

share|improve this answer
what's the implication of stty -ixon? does it disable something that might be needed in other situations? – Gregory Pakosz Feb 1 '12 at 19:39
@GregoryPakosz: It disables XON/XOFF (software flow control), which is useless from the keyboard now that we're communicating at a little bit higher rate than 300 baud. – Dennis Williamson Feb 1 '12 at 22:31
thank you, googled for a while and came to the same conclusion, it's mostly useless nowadays – Gregory Pakosz Feb 3 '12 at 11:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .