You probably already know that to navigate forward and backward in time your command line history, you use arrows. Arrow up: previous command. Arrow down: next command. What if you have to navigate more?
For example, suppose you yesterday looked at a text file. You don't remember its name, but you know you used "cat" to see it. And now you want to see it again. Normally you should have to (a)use the up arrow a lot until you meet the command you wanted or (b)use some trick like
cat ~/.bash_history | grep cat and then copy-and-paste the right command.
Good, but it could be better. The science package Matlab for example has a nifty feature that allows you to search in your Matlab command line intelligently, autocompleting the first characters you have typed with matching lines of your command line history. This means that you type "cat" on your command line, by using the up and down arrows you navigate only the history of commands beginning with "cat". A kind of interactive grep on the go. Nice, isn't it?
For some reason this really useful feature is not enabled by default on most Unix distributions I am aware of, but it is really easy to activate it on Bash. Look for a file called
.inputrc in your home directory. If you haven't it, look for
/etc/inputrc instead (you of course have to be root to edit this one). Open it with your favourite text editor and look for these lines:
Comment them with a "#" character in front of them:
Insert these lines below the ones you just commented:
Save and exit. To make the changes have effect you probably have to login again. Now pressing Page-Up and Page-Down should autocomplete the first characters you type with the corresponding commands in the history. Once you get accustomed to this feature, you'll never want to come back.