2013-09-27

Bash Terminal History Completion in Ubuntu Linux

You know how Google will autocomplete your searches based on searches you've previously done?  Ubuntu Linux can do something similar.  To recall a previously-run command, simply type the first part of the command and use the up and down arrow keys to navigate backward and forward through your command history:


To add this function, make the following changes in the .bashrc file in your user folder:



increase HISTSIZE and HISTFILESIZE to 100000

add the following code:

## Up Arrow: search and complete from previous history
bind '"\e[A":history-search-backward'
## Down Arrow: search and complete from next history
bind '"\e[B":history-search-forward'

If those don't seem to work for you after a restart, try binding \eOA and \eOB instead!

(via: http://jeetworks.org/node/106)