Making History with Bash

This is a nifty little trick for making Bash a little more intuitive (for my taste). Usually, when you press the up key, Bash will bring back the last command you typed. This is cool, but what bothers me is that sometimes I start typing a command and then remember I executed it before. So I press the up key and… Bash shows me the last command, disregarding what I typed. What I want it to do is search history for things with the prefix I entered.


This is a companion discussion topic for the original entry at http://amir.rachum.com/blog/2013/01/15/making-history-with-bash/

Press the PageUp key and Bash will show you the previous command that matches what you have typed in

Pressing C-r does something similar.

Or you could just use ZSH :P - https://github.com/robbyrussel...

Tried it, didn't work.

This is a clever trick, but it broke my ability to do CTRL-<right arrow=""> or CTRL-<left arrow=""> to jump word by word around in a command. Adding this below in ~/.inputrc fixed it:

# Fix CTRL-RIGHT ARROW and CTRL-LEFT ARROW to jump around word by word
"\C-[[1;5D": backward-word
"\C-[[1;5C": forward-word