The Uncarved Block

Shell Command History and Searching

Time spent learning how the unix shell works is never wasted

One of the easiest ways to improve your productivity on unix systems is to become acquainted with your shell's history completion and search facilities. All of these described here are common to zsh and bash, although zsh has some additional features that bash does not.

Firstly, if you ever find yourself tapping the up arrow to scroll through your command history, you are living in a state of sin- either type history 100 or something similar to actually get a history list or use Ctrl-R to do a recursive incremental search through your shell history. Secondly, learn and use some basic history completions:

There are lots more possible history completions but I use those three ten times for any one of them. Also useful are:

You can combine these with the first three constructs by adding a colon, so:

permalink Updated: 2006-05-17