Documenting Problems That Were Difficult To Find The Answer To

Searching BASH History with Ctrl-R

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.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: