Skip to content

Essential Terminal Keyboard Shortcuts

Reaching for the mouse — or worse, holding down backspace to fix a typo — is one of the biggest hidden time-sinks for terminal users. These shortcuts work in Bash and Zsh (the default shells on most Linux distros and macOS) and cover the moves you’ll use dozens of times a day.

Shortcut Action
Ctrl + A Jump to the start of the line
Ctrl + E Jump to the end of the line
Alt + F Move forward one word
Alt + B Move back one word
Ctrl + XX Toggle between the current cursor position and the start of the line
Shortcut Action
Ctrl + U Delete from the cursor to the start of the line
Ctrl + K Delete from the cursor to the end of the line
Ctrl + W Delete the word before the cursor
Alt + D Delete the word after the cursor
Ctrl + Y Paste back the last thing you deleted with U/K/W
Ctrl + _ Undo the last edit
Shortcut Action
Ctrl + R Search command history interactively (type to filter, Ctrl + R again for older matches)
Ctrl + G Cancel a history search and restore the original line
!! Re-run the previous command
!$ Insert the last argument of the previous command
Alt + . Insert the last argument of the previous command, cyclable by pressing again
Shortcut Action
Ctrl + C Send SIGINT — stop the current foreground process
Ctrl + Z Suspend the current process and return to the shell (resume later with fg)
Ctrl + D Send EOF — closes the shell/input if the line is empty
Ctrl + L Clear the screen (like running clear, but doesn’t wipe scrollback)

If you use tmux (and if you don’t yet, it’s worth trying), these are the defaults with the standard Ctrl + B prefix:

Shortcut Action
Ctrl + B then c Create a new window
Ctrl + B then % Split the current pane vertically
Ctrl + B then " Split the current pane horizontally
Ctrl + B then arrow key Move between panes
Ctrl + B then d Detach from the session (reattach later with tmux attach)

If you run set -o vi in Bash (or have bindkey -v in Zsh), your line editing switches to vi-style modal editing — Esc drops you into a command mode where h/j/k/l, 0/$, dw, and . behave much like they do in the vi/vim editor. History search still works with Ctrl + R in insert mode, or / and ? once you’re in command mode.

The fastest way to actually remember these is to pick two or three you don’t already use, and force yourself to use them exclusively for a week instead of arrow keys or backspace. Ctrl + R for history search and Ctrl + A / Ctrl + E for line jumps are the highest-value place to start.