Unix: Command history search

Published:

In a Unix Bash shell we can scroll through previous commands by using the up and down arrow keys, but we can also search for previous commands. I keep forgetting how, so time to write it down πŸ˜›

Ctrl+r

Start a command search
⏎Run the command directly

Ctrl+e or Ctrl+a

Exit search and jump to the end or beginning of command.

← or β†’

Exit search and move through command as usual

Ctrl+k

Remove everything after the current cursor position and to the end of the command