I wanted to use the reverse-i-search as usual by pressing Ctrl+R to search my last ssh command. When I tried, I was only able to write "ss" but not continue with "h". Additionally when I hit Ctrl+H again, nothing happens. Does anybody have an explanation?
I am using Ubuntu 12.04 and in the pasttime this worked fine (on my other computer with the same os)
3 Answers
Try like this:
[...] first press Ctrl+R then start typing the command or any part of the command that you are looking for. You'll see an auto-complete of a past command at your prompt. If you keep typing, more specific options will appear. You can also press Ctrl+R again as many times as you want to, this goes back in your history to the previous matching command each time
Once you see a command you like, you can either run it by pressing return, or start editing it by pressing arrows or other movement keys.
Source: Navigating Bash History with Ctrl+R.
2From:
An extremely handy tool :: Incremental history searching
in terminal enter:
gedit ~/.inputrcthen copy/paste and save:
"\e[A": history-search-backward
"\e[B": history-search-forward
"\e[C": forward-char
"\e[D": backward-charFROM now on and many agree this is the most useful terminal tool saves you a lot of writing/memorizing... all you need to do to find a previous command is to enter say the first 2 or 3 letters and upward arrow will take you there quickly. Say I want:
for f in *.mid ; do timidity "$f"; doneall I need to do is enter
foand hit upward arrow. Command will soon appear!
3Run this command in terminal. Use Ctrl+S to toggle forward when searching for commands in the terminal. For current session- add it to .bashrc to disable it permanently.
stty -ixon
ctrl+r -> reverse i search
ctrl+s -> i search