Searching BASH History with Ctrl-R
October 15, 2014
Posted by on
In the BASH shell one can quickly recall a history command they previously entered a number of ways.
- history command
- !history_num – expand to history number
- ctrl-R – search through history interactively (ctrl-R again to repeatedly search)
- ctrl-J (or ESC) – finish searching leaving command on line
- ctrl-G – cancel search and clear command line
- ctrl-P – show the previous command
- ctrl-N – show the next command
- meta-> (ESC then shift->) – jump to most recent entry in history
- meta-< (ESC then shift-<) – jump to beginning (oldest) entry in history
Thanks to this blog post for revealing how to “reset” the command history pointer.