
The search prompt disappears and the command history can be scrolled using the same keys you would use at the command prompt to search through all the shell history. Type in the text you want to search for (i.e., perl) and then press the up and down keys without pressing enter. To invoke the history search, you must still press -R which will present the search prompt. These two commands allow for the history to be searched using the up and down arrow keys. This can be remedied by editing the ~/.zshrc file and adding a few bindkey statements: Unfortunately, on many terminals, -S which should do forward searching, does not work so if you accidentally hit -R one too many times, you’re stuck having to abort and do it over again.


With repeated -R keys, searching continues backwards for any shell commands that match. By default, the zsh shell will respond to the -R key sequence to search through the history based on what you type in. History searching is handy in these cases. Usually these commands are scripts themselves and the arguments passed to them will change over time or with what you are working on. It’s usually not anything you can necessarily script as the commands may vary slightly on each invocation, but there are certain commands that can be used often with a little variation on each call. If you spend any length of time in the shell, chances are you’ve typed the same commands over and over.
#UP AND DOWN ARROWS HISTORY HOW TO#
Vincent Danen explains how to get more out of the search history features in the zsh shell.
