tags:

views:

375

answers:

1

I am trying to search my bash history similarly as with CTRL-r, but to forward direction.

It has been a pain for me, when I just hit once too often CTRL-r, to find the previous command again.

How can you forward search your Bash history similarly as in reverse searching?

+2  A: 

You can search forward as well. From the bash info manual, "8.2.5 Searching for Commands in the History":

To search backward in the history for a particular string, type C-r'. Typing C-s' searches forward through the history.

The problem with Ctrl-S however is that sometimes collides with XON/XOFF flow control (in Konsole for instance). The searching is a readline feature however, and you should be able to bind it to some other key. Update: Simpler and better is just to disable XON/XOFF by running

stty -ixon
hlovdal
It seems to collide with XON/XOFF all the time for me, since I cannot get Ctrl-S working. How can you bind the search to other key?
Masi
How can you turn off XON/XOFF? It seems that I do not need them.
Masi
@hlovdal: Thank you very much! You saved my day :)
Masi