Skip to content

Bash Terminal Keyboard Shortcuts

Note

  • The following keyboard shortcuts or commands may vary depending on Bash configuration
  • Keyboard shortcuts or commands may work on Bash variants (e.g. Fish)

Keyboard Shortcuts

Task Command Example Description
Break Command CTRL-C Kill the current foreground running process.
Exit CTRL-D Shortcut for the command exit. Command line must be empty to work.
Run In Background CTRL-Z Run the command/process in the background. Same as ending a command with an &.

Change Text

Task Command Example Description
Capitalize Word ALT-C Capitalize the current or following word.
Delete Character CTRL-D Delete character at the cursor current position.
Delete To End CTRL-K Delete from the cursor position to the end of the line.
Delete To Start CTRL-U Delete form the cursor position to the start of the line.
Delete Undo CTRL-Y Restore last deleted text by CTRL-K, CTRL-U and CTRL-W.
Delete Word CTRL-W Delete one word from the cursor position towards the start of the line.
Insert New Line CTRL-J Insert a newline control character.
Insert Special Character CTRL-V Add the next character typed to the line verbatim.
Insert Tab CTRL-V-TAB Insert a tab character.
Lowercase Word ALT-L Lowercase the current or following word.
Move Character CTRL-T Move the character before the cursor forward by one position.
Move Word ALT-T Move a word before the cursor.
Uppercase Word ALT-U Uppercase the current or following word.

Completing

Task Command Example Description
Complete TAB Type a partial text to complete the command, directory or file name.
Filename ALT-/ Attempt filename completion on the text.
Filename Possible List CTRL-X-/ List the possible completions of the text as a filename.
Insert Complete ALT-* Insert all completions of the text.
Possible List ALT-? List the possible completions of the text.

History

Task Command Example Description
Exit History CTRL-G Exit command history.
Insert Last Word ALT-. Insert the first argument to the previous command
Next Command Arrow Down Show next command from history. Repeat command to go forward in history.
Next Command CTRL-N Show next command from history. Repeat command to go forward in history.
Previous Command Arrow Up Show previous command from history. Repeat command to go back in history.
Previous Command CTRL-P Show previous command from history. Repeat command to go back in history.
Search History CTRL-R History search in reverse.
Search History CTRL-S History search forward.

Moving

Task Command Example Description
Back One Character CTRL-B Move the cursor a character.
Back One Word ALT-B Move the cursor back to the start of the current or previous word.
Clear Screen ALT-CTRL-L Clear the screen and if possible the terminal's scrollback buffer, then redraw the current line, leaving current line at the top of screen.
Clear Screen CTRL-L Clear the screen and redraw the current line, leaving current line at the top of screen. Shortcut for the command clear.
End of Line CTRL-E Move the cursor to the end of the line.
Forward One Character CTRL-F Move forward a character.
Forward One Word ALT-F Move the cursor forward to the end of the next word.
Start of Line CTRL-A Move the cursor to the start of the current line.