bash: Searching

1 
1 8.2.5 Searching for Commands in the History
1 -------------------------------------------
1 
1 Readline provides commands for searching through the command history
1 (⇒Bash History Facilities) for lines containing a specified
1 string.  There are two search modes: "incremental" and
1 "non-incremental".
1 
1    Incremental searches begin before the user has finished typing the
1 search string.  As each character of the search string is typed,
1 Readline displays the next entry from the history matching the string
1 typed so far.  An incremental search requires only as many characters as
1 needed to find the desired history entry.  To search backward in the
1 history for a particular string, type 'C-r'.  Typing 'C-s' searches
1 forward through the history.  The characters present in the value of the
1 'isearch-terminators' variable are used to terminate an incremental
1 search.  If that variable has not been assigned a value, the <ESC> and
1 'C-J' characters will terminate an incremental search.  'C-g' will abort
1 an incremental search and restore the original line.  When the search is
1 terminated, the history entry containing the search string becomes the
1 current line.
1 
1    To find other matching entries in the history list, type 'C-r' or
1 'C-s' as appropriate.  This will search backward or forward in the
1 history for the next entry matching the search string typed so far.  Any
1 other key sequence bound to a Readline command will terminate the search
1 and execute that command.  For instance, a <RET> will terminate the
1 search and accept the line, thereby executing the command from the
1 history list.  A movement command will terminate the search, make the
1 last line found the current line, and begin editing.
1 
1    Readline remembers the last incremental search string.  If two 'C-r's
1 are typed without any intervening characters defining a new search
1 string, any remembered search string is used.
1 
1    Non-incremental searches read the entire search string before
1 starting to search for matching history lines.  The search string may be
1 typed by the user or be part of the contents of the current line.
1