Terminal Keyboard Shortcuts Worth Learning
There are two kinds of terminal user: those who press the up arrow thirty times to find a command they ran last Tuesday, and those who press three keys. This cheat sheet is for anyone wishing to defect to the second group.
The line-editing shortcuts below come from readline (Bash) and Zsh’s equivalent, both of which default to the same Emacs-style bindings — so learn them once and they work essentially everywhere, including most database consoles and REPLs. A rare case where the industry standardised on something decent and moved on.
The one shortcut to learn today
Section titled “The one shortcut to learn today”Ctrl+R — reverse search through your command history. Press it, start typing any fragment of the command you want, and the shell finds the most recent match. Press Ctrl+R again to step further back through matches, Enter to run the result, or the arrow keys to edit it first.
If you memorise nothing else from this page, memorise that. It’s the single highest-yield keystroke in the terminal.
Moving around the line
Section titled “Moving around the line”| Shortcut | Effect |
|---|---|
| Ctrl+A | Jump to start of line |
| Ctrl+E | Jump to end of line |
| Alt+B | Back one word |
| Alt+F | Forward one word |
| Ctrl+B / Ctrl+F | Back / forward one character (the arrow keys, for purists) |
Editing like you mean it
Section titled “Editing like you mean it”| Shortcut | Effect |
|---|---|
| Ctrl+U | Cut everything before the cursor (Zsh: the whole line) |
| Ctrl+K | Cut everything after the cursor |
| Ctrl+W | Cut the word before the cursor |
| Alt+D | Cut the word after the cursor |
| Ctrl+Y | Paste the most recently cut text |
| Ctrl+_ | Undo |
| Alt+. | Insert the last argument of the previous command (repeat to go further back) |
The Ctrl+U / Ctrl+K / Ctrl+W cuts go onto a paste buffer, so “cut” here is really “cut with intention to re-use” — Ctrl+Y brings it back, even in a different command. The one place the two shells part company is Ctrl+U: Bash cuts back to the start of the line, while Zsh takes the entire line with it, cursor position be damned.
Alt+. deserves special mention: retyping the long path from your previous command is a mug’s
game. mkdir some/deeply/nested/path followed by cd + Alt+. is the civilised alternative.
History without the up arrow
Section titled “History without the up arrow”| Shortcut | Effect |
|---|---|
| Ctrl+R | Reverse-search history (see above; it’s that important) |
| Ctrl+G | Abandon the search |
| Ctrl+P / Ctrl+N | Previous / next history entry (the up/down arrows, but closer) |
!! |
Re-run the previous command |
!$ |
The last argument of the previous command |
!ssh |
Re-run the most recent command starting with ssh |
Yes, sudo !! — re-run the last command but with sudo — works, and remains the most satisfying
two characters in computing after a permission error.
Process control
Section titled “Process control”| Shortcut | Effect |
|---|---|
| Ctrl+C | Kill the foreground process (SIGINT) |
| Ctrl+Z | Suspend the foreground process |
| Ctrl+D | End of input — exits the shell if the line is empty |
| Ctrl+L | Clear the screen (keeps your scrollback, unlike clear on a bad day) |
Worth knowing that these are the keys terminal tools fight over. tmux claims exactly one of them
(Ctrl+B); Zellij claims about eight, all of which the shell was using
first — which is a genuine argument against it, and one its own locked mode exists to answer.
Ctrl+Z deserves better than its reputation as “the key I pressed by accident”. Suspended jobs
are listed with jobs, resumed in the foreground with fg, or sent to the background with bg
— handy when you realise thirty seconds into a long task that you still need your terminal.
Tabs, panes and windows
Section titled “Tabs, panes and windows”Line editing is only half the story — the other half is wrangling the terminal window itself. Defaults for the popular options (all customisable; check your app’s keybindings if these feel off):
| Action | iTerm2 | Warp | Ghostty | Windows Terminal |
|---|---|---|---|---|
| New tab | Cmd+T | Cmd+T | Cmd+T | Ctrl+Shift+T |
| New window | Cmd+N | Cmd+N | Cmd+N | Ctrl+Shift+N |
| Close tab | Cmd+W | Cmd+W | Cmd+W | Ctrl+Shift+W |
| Next / previous tab | Cmd+Shift+] / [ | Cmd+Shift+] / [ | Cmd+Shift+] / [ | Ctrl+Tab / Ctrl+Shift+Tab |
| Split pane right | Cmd+D | Cmd+D | Cmd+D | Alt+Shift++ |
| Split pane down | Cmd+Shift+D | Cmd+Shift+D | Cmd+Shift+D | Alt+Shift+- |
| Search scrollback | Cmd+F | Cmd+F | Cmd+F | Ctrl+Shift+F |
Windows Terminal’s Alt+Shift+D is a third thing again: it duplicates the current pane and
picks the split direction for you, which is either convenient or infuriating depending on how
attached you are to knowing where the new pane will land.
Notable by absence: Alacritty ships without tabs or panes at all, on
principle — the expectation being that you pair it with tmux, which has a cheat sheet of its
own and a separate personality. kitty, for contrast, does the whole
job itself; the two are worth comparing before you commit to
either philosophy.
If none of these defaults appeal, the apps differ wildly in how configurable they are — our terminal emulator roundup covers the trade-offs, and on macOS the shortlist is usually Ghostty or iTerm2.
Now the rest of the setup
Section titled “Now the rest of the setup”Fast fingers deserve a prompt that keeps up — see customising your shell prompt with Starship. And if you’re going to press keys this enthusiastically, you may as well enjoy the sound they make: our mechanical keyboard roundup has you covered.