Bash Shortcuts Quick Reference

Ctrl-a          Move to the start of the line.
Ctrl-e          Move to the end of the line.
Ctrl-b          Move back one character.
Ctrl-f          Move forward one character.
Alt-b           Move back one word.
Alt-f           Move forward one word.
Ctrl-] x        Where x is any character, moves the cursor forward to the next occurance of x.
Alt-Ctrl-] x    Where x is any character, moves the cursor backwards to the previous occurance of x.
Ctrl-u          Delete from the cursor to the beginning of the line.
Ctrl-k          Delete from the cursor to the end of the line.
Ctrl-w          Delete from the cursor to the start of the word.
Esc-Del         Delete previous word (may not work, instead try Esc followed by Backspace)
Ctrl-y          Pastes text from the clipboard.
Ctrl-l          Clear the screen leaving the current line at the top of the screen.
Ctrl-x Ctrl-u   Undo the last changes. Ctrl-_ does the same
Ctrl-_          Undo the last command. Don’t forget – it’s Ctrl-Shift-MINUS, not Ctrl-MINUS.
Alt-r           Undo all changes to the line.
Alt-Ctrl-e      Expand command line.
Ctrl-r          Incremental reverse search of history.
Alt-p           Non-incremental reverse search of history.
!!              Execute last command in history
!abc            Execute last command in history beginning with abc
!abc:p          Print last command in history beginning with abc
!n              Execute nth command in history
!$              Last argument of last command
!^              First argument of last command
^abc^xyz        Replace first occurance of abc with xyz in last command and execute it 

Alt-u/Alt-l/Alt-c Uppercase/lowercase/capitalize from cursor to end of word and move cursor past end of word.

Ctrl-s          Suspend currently running terminal.
Ctrl-q          Unsuspend the terminal suspended by Ctrl-S. You need to be aware of this shortcut because 99% of the time you’ve accidentally pressed Ctrl-S and need to undo its effects.

Ctrl-z          Suspend the currently running process (usually followed by bg to resume it in the background or fg to resume in the foreground).

TAB             Autocomplete. Start typing, then hit TAB. You will either get a list of possible completion values (2 TABs needed) or the only choice will be filled in (only 1 TAB is needed).
Advertisements