When in a Bash shell you can do a backwards search. This is a search through the commands you’ve typed in to re execute them easily. Try it now, go to a Bash window and press CTRL-R. Now you can start typing something.
When you find the command you want to run, just press Enter.
If you want to edit the command, move through it with the left and right arrows.
If you want to move to the next matching command, press CTRL-R again, until you find the right command.
To leave the search, press CTRL-G
Here are the common Bash key bindings that will help you on your daily work. Some of these work on the backwards search also:
Ctrl-r History reverse search
Ctrl-a Jump to BOL
Ctrl-e Jump to EOL
Ctrl-l Clear terminal
Ctrl-k Delete from cursor to EOL
Ctrl- Undo last operation
Ctrl-w Delete word left from cursor
Ctrl-u Delete from BOL to cursor
Ctrl-x Ctrl-e Open the default editor $EDITOR and run edited command
Ctrl-p Previous command in history
Ctrl-n Next command in history
Ctrl-f Move forward a char
Ctrl-b Move backward a char
Alt-f Move forward a word
Alt-b Move backward a word
Ctrl-d Delete char under cursor. Exit shell if empty.
Alt-d Delete forward word
Ctrl-y Paste content of the kill ring
Ctrl-t Swap current char with previous char
Alt-t Swap current word with previous word
Alt-u Uppercase word at cursor
Alt-l Lowercase word at cursor
Ctrl-s Freeze terminal
Ctrl-q Restore frozen terminal
Shift-PgUp Scroll screen up
Shift-PgDn Scroll screen down
Most of these key bindings work in Emacs too.