/ Tech

History auto-complete in bash

Sometimes, when using bash, you want to find a command in your history that starts with something you remember. Rather than scrolling through hundreds of commands that just read cd, ls, pwd, etc, you can search your bash history.

Put the following in your .bashrc file:

bind '"\e[A": history-search-backward'
bind '"\e[B": history-search-forward'

This will bind the up and down arrows and let you search easier.