zsh Cheatsheet
5.9Get more from your shell
Essential zsh shortcuts, tricks, and keybindings for your terminal
Official docs →Last updated: 2026-03-29
zsh is the default shell on macOS and gaining serious ground on Linux, and for good reason — it takes everything bash does and adds smarter completion, better globbing, and a plugin ecosystem that can turn your terminal into something genuinely enjoyable to use. If you've been using zsh without knowing it (thanks, macOS Catalina), you've been driving a sports car in first gear.
The real power of zsh lives in its line editor. Those Ctrl and Alt key combos aren't random — they come from Emacs-style editing, which is the default mode. Every time you hit Ctrl-a to jump to the start of a line, you're using the same binding that Emacs users have been using since the 1970s. You can also switch to vi mode if that's your thing, but start with the defaults. They're surprisingly good once you internalize them.
This cheatsheet focuses on what'll make you faster right away: line navigation so you stop reaching for the arrow keys, history tricks that save you from retyping commands, globbing patterns that let zsh find files for you, and enough oh-my-zsh knowledge to set up a productive environment without drowning in options. We're skipping the 400-page manual and keeping the stuff that pays off daily.
Line Navigation
These work in the default Emacs mode (which is what you're using unless you've explicitly switched to vi). Burn these into muscle memory and your hands never leave the home row.
History
Your shell history is a goldmine. zsh keeps thousands of commands by default, and these shortcuts help you mine them efficiently instead of mashing the up arrow 47 times.
Globbing
This is where zsh leaves bash in the dust. zsh's globbing is so powerful it can replace find for most day-to-day file searches. No pipes, no subshells, just patterns.
Aliases
Aliases are how you make zsh feel like your own. Here are the patterns worth knowing — the specific aliases are up to you, but these forms unlock the most productivity.
Key Bindings
zsh's line editor (zle) is fully customizable. You can rebind any key to any action, and there are hundreds of built-in widgets to choose from.
Vi Mode
If you're a vim/nvim user, vi mode makes zsh feel like home. You get normal mode, insert mode, and most of the motions you already know.
oh-my-zsh Essentials
oh-my-zsh is the most popular zsh framework, and it earns it. But with 300+ plugins, it's easy to bloat your config. Here are the plugins and patterns that are actually worth loading.
Tips
Add setopt AUTO_CD to your ~/.zshrc and you can navigate directories by just typing the path — no cd required. Type .. to go up a directory, ~/projects to jump home. Once you get used to this, typing cd feels like wasted keystrokes.
The zsh-autosuggestions plugin is arguably the single biggest productivity boost you can add. It shows ghost text predictions as you type based on your history. Press the right arrow key to accept the whole suggestion, or Alt-f to accept just the next word. Install it and wonder how you ever lived without it.
Use Ctrl-x Ctrl-e (after binding it with autoload -z edit-command-line && zle -N edit-command-line && bindkey '^X^E' edit-command-line) to open the current command line in your $EDITOR. Long commands with pipes and loops are way easier to compose in nvim than on a single terminal line.
Configure your history properly. Add these to ~/.zshrc and you'll never lose a command again:
HISTSIZE=50000, SAVEHIST=50000, setopt SHARE_HISTORY (sync across sessions), setopt HIST_IGNORE_DUPS (skip consecutive duplicates), setopt HIST_IGNORE_SPACE (prefix with space to keep it out of history — handy for commands with secrets).
zsh's recursive globbing (**/*) is powerful enough to replace basic find usage. Want all TypeScript files? ls **/*.ts. Want to delete all .DS_Store files? rm -f **/.DS_Store. It's faster to type and easier to remember than find . -name "*.ts".
If Alt key combos don't work in your terminal (common on macOS), go to your terminal's preferences and enable "Use Option as Meta key." In iTerm2 it's under Profiles > Keys. In Terminal.app, it's under Settings > Profiles > Keyboard. Without this, Alt-f, Alt-b, and Alt-d are dead on arrival.
Suffix aliases are an underrated zsh feature. Add alias -s py=python3 to your ~/.zshrc and you can run a Python script by just typing its filename: script.py instead of python3 script.py. Works for any extension — map .json to jq ., .md to your markdown viewer, .log to less.