Incremental Search in Bash and ZSH

June 24, 2012

Every once in a while I stumble upon something on my own computer I am amazed by. Easter eggs? No, more like me not fully looking into functionality. In anycase, maybe I'll expose some Bash and Zsh users to this feature as maybe there are some that are clueless like I was.

Incremental History Search autocompletes your command as you type based on your history file. All you do is hit Control-R in a Bash or Zsh shell to trigger this functionality and you will be greeted with a prompt that looks something like this:

Incremental Search in Bash and Zsh

As you start to type your prompt will match the last command from your history. If you want to see earlier matches from your history, just continually press Control-R.

Incremental Search Completion in Bash and Zsh

Simple, time saving, and a great feature!