Complete Zsh keyboard shortcuts reference — 20 shortcuts across 3 categories. Quick reference cheat sheet for Windows & Mac.
| Shortcut | Action |
|---|---|
| Ctrl + A | Start of line |
| Ctrl + E | End of line |
| Alt + F | Forward one word |
| Alt + B | Back one word |
| Ctrl + F | Forward one char |
| Ctrl + B | Back one char |
| Shortcut | Action |
|---|---|
| Ctrl + U | Kill whole line |
| Ctrl + K | Kill to end |
| Ctrl + W | Delete word before |
| Alt + D | Delete word after |
| Ctrl + Y | Yank |
| Ctrl + _ | Undo |
| Alt + Q | Push line |
| Shortcut | Action |
|---|---|
| Ctrl + R | Search history |
| Ctrl + P | Previous command |
| Ctrl + N | Next command |
| Alt + . | Insert last argument |
| Tab | Complete |
| Ctrl + L | Clear screen |
| Ctrl + D | Exit / delete char |
Zsh's line editor (ZLE) starts in Emacs keymap for most setups, which is why these keys look familiar to Bash users: Ctrl + A and Ctrl + E jump to the ends of the line, Alt + F / Alt + B step by words, Ctrl + F / Ctrl + B by characters. The deletion keys are kills, not deletes: Ctrl + U kills the whole line, Ctrl + K to the end, Ctrl + W the word behind, Alt + D the word ahead — and everything killed lands in a ring that Ctrl + Y yanks back. Cut-and-paste on the command line, no mouse involved. Ctrl + _ undoes edits.
History is the other half: Ctrl + R opens incremental search, Ctrl + P / Ctrl + N walk previous and next commands, and Alt + . inserts the last argument of the previous command — press it repeatedly to reach earlier commands' arguments. Tab completes, Ctrl + L clears the screen without losing your input.
Alt + Q (push-line) stashes whatever you are typing, gives you a fresh prompt to run something else — check a path, read a man page — and restores your original line afterwards, untouched. It removes the classic dilemma of abandoning a half-written command. And know Ctrl + D's double life: with text on the line it deletes the character under the cursor; on an empty line it sends end-of-file and exits the shell — the source of many accidentally closed terminals.
You are probably in the Vi keymap — zsh selects it automatically when your EDITOR variable points at vi/vim. Run bindkey -e to switch to Emacs bindings (add it to ~/.zshrc to make it stick), or embrace bindkey -v and use Vi-style editing instead.
Killed text (Ctrl + U, Ctrl + K, Ctrl + W, Alt + D) is saved to the kill ring and can be reinserted with Ctrl + Y — it is cut, not destroyed. Plain character deletion is gone for good (though Ctrl + _ can undo the edit).
macOS terminals type accented characters on Option by default. In Terminal.app or iTerm2, enable the profile setting that uses Option as Meta (Esc+), and Alt + F, Alt + B, Alt + . start working immediately.
Mid-command realisations: you are halfway through a long command and need to check a filename or free disk space first. Alt + Q stashes the line, you run the check, and the stashed command reappears at the next prompt ready to finish — no copy-paste, nothing lost.
On an empty line Ctrl + D means end-of-file, which ends the shell. Add setopt IGNORE_EOF to ~/.zshrc and zsh will ignore it (asking you to type exit instead), while keeping the delete-character behaviour when the line has content.
Open your assistant with this page preloaded as the source — great for follow-up questions like "which of these work in other apps?"