Bash shortcuts

Updated 4 March 2019


For easier handling, all shortcuts are sorted by action. Note that Alt means left Alt, as the right Alt Gr is used as the Compose key.

Movement shortcuts

Shortcut Action
Ctrl+a, Home Go to the start of the command line
Ctrl+e, End Go to the end of the command line
Ctrl+b, Move backward one character
Ctrl+f, Move forward one character
Alt+b, Esc+b Move backward one word
Alt+f, Esc+f Move forward one word
Ctrl+xx Move between start of command line and current cursor position (and back again)

Editing shortcuts

Shortcut Action
Alt+?, Tab+Tab Show current command or filename completion list
Ctrl+u Delete from cursor to the start of the command line
Ctrl+k Delete from cursor to the end of the command line
Ctrl+w Delete from cursor to space on the left
Alt+Backspace Delete from cursor to start of word
Alt+d, Esc+d Delete from cursor to end of word
Ctrl+y Paste word or text that was cut using one of the deletion shortcuts (such as the one above) after the cursor
Alt+y After Ctrl+y, choose from word deletion history.
Ctrl+h Delete a character before the cursor
Ctrl+d Delete a character under the cursor
Alt+\ Delete spaces around the cursor
Ctrl+_ Undo
Alt+r, Esc+r Undo all changes to the line
Alt+c Capitalize the word and move cursor at the end of the word
Alt+u Capitalize the word
Alt+l Make word lowercase
Alt+t Replace current word under the cursor with previous word
Ctrl+t Swap the character before the cursor with the previous one

History shortcuts

Shortcut Action
Ctrl+r Search the history backwards
Ctrl+g Escape from history searching mode
Ctrl+p, Previous command in history
Ctrl+n, Next command in history
Alt+< Move to the first line in the history
Alt+., Esc+. Use the last word of the previous command
Ctrl+o Run the command and re-enter it

Control and output shortcuts

Shortcut Action
Ctrl+l Clear the screen
Ctrl+s Stop the output to the screen
Ctrl+q Resume the output to the screen if it was suspended by above
Ctrl+c Terminate the command
Ctrl+z Suspend the current command (to resume, run fg)
Ctrl+d Quit Bash shell

Information shortcuts

Shortcut Action
*+Alt+?, *+Tab+Tab Show folders except for hidden
$+Alt+?, $+Tab+Tab Show all system variables

Special keys

Shortcut Action
Ctrl+i Tab
Ctrl+m Enter
Ctrl+[ Esc