What this covers
A complete reference for every Claude Code keyboard shortcut: session control, permission modes, input editing, history, IDE integration, and terminal compatibility.
Key tools and concepts:
- Claude Code: Anthropic’s command-line AI coding agent that can read, edit, and run code in your terminal.
- Claude: Anthropic’s conversational AI assistant (similar in role to ChatGPT) with file, long-context, and tool support.
Who this is for
Developers who already run claude and want to keep both hands on the keyboard — turning “find the key” into “press it.” If you haven’t installed it yet, read the Claude Code Beginner Guide first.
When to reach for it
- You write long prompts and want readline-style editing to rewrite quickly.
- You move between Plan, Auto-Accept, and Default permission modes a lot.
- The agent drifts and you want to interrupt, rewind, and keep what worked.
- A key stops responding after switching terminals (iTerm2, Apple Terminal, VS Code, JetBrains, Warp) and you need to diagnose it.
Before you start
- Press
?once you are in a session and skim the shortcuts your environment actually ships — this page covers the common set, but versions and terminals vary. - If
Shift + Enterdoesn’t insert a newline, run/terminal-setupso Claude writes the terminal config for you. - On macOS, configure Option as Meta (or “Esc+”) in iTerm2 / Apple Terminal, or every
Option + <letter>combo will be silently dropped.
Session-level control
| Shortcut | What it does | When to use it |
|---|---|---|
? | Shows the active shortcut help | When you forgot a key, switched terminals, or just installed |
Ctrl + C | Cancels current input; twice in a row exits the session | To clear the input box, or to fully exit |
Ctrl + D | Exits when the input is empty | One keystroke instead of Ctrl + C twice |
Esc | Interrupts Claude’s current reply or tool call | To redirect without losing finished work |
Esc then Esc | Opens the rewind / checkpoint menu | To return to an earlier tool call or undo a code / conversation state |
Ctrl + L | Redraws the terminal screen | When output looks stale or is overwritten by external logs |
Ctrl + Z | Suspends the entire Claude process to background | To pop back to the shell briefly; bring it back with fg |
Ctrl + B | Backgrounds the running task | When a long agent run shouldn’t block the main UI |
Ctrl + T | Shows / hides the task list | To inspect subagents, background commands, and long-running tasks |
Memorize the difference between Esc and Ctrl + C. Esc interrupts only the current turn — generated code and files Claude has already read stay in context. Ctrl + C clears the input box.
Permission mode switching
| Shortcut | What it does |
|---|---|
Shift + Tab | Cycles through permission modes |
Common modes (your menu labels may differ slightly):
- Default / Ask: every write asks first. Safest for unfamiliar tasks.
- Auto-accept edits: file edits go through automatically; Bash still confirms. Great for refactors, batch edits, test loops.
- Plan mode: read-only planning, no writes allowed. Use to make Claude think before it touches anything.
- Bypass / YOLO: skips nearly all confirmations. Only consider it inside isolated environments (git worktree, container, throwaway directory).
Shift + Tab advances one mode per press. The current mode is shown next to the input or at the top of the screen.
Input editing (readline-style)
Claude Code’s input box follows readline / Emacs conventions, so most shortcuts that work in bash or zsh work here too.
| Shortcut | What it does |
|---|---|
Ctrl + A | Jump to start of line |
Ctrl + E | Jump to end of line |
Ctrl + F / → | Move one character right |
Ctrl + B in input / ← | Move one character left (note: Ctrl + B outside the input backgrounds a task) |
Alt + F / Option + → | Jump one word right |
Alt + B / Option + ← | Jump one word left |
Ctrl + K | Delete from cursor to end of line |
Ctrl + U | Delete from cursor to start of line |
Ctrl + W | Delete previous word |
Alt + D | Delete next word |
Ctrl + H / Backspace | Delete previous character |
Ctrl + Y | Yank back the most recently deleted text (kill ring) |
Ctrl + T in input | Swap the two characters around the cursor |
Note: Ctrl + T means “swap characters” inside the input and “task list” outside. Claude Code picks the right behavior based on focus.
Multiline input
| Input | What it does | Compatibility |
|---|---|---|
Shift + Enter | Newline | Most modern terminals once configured |
Ctrl + J | Newline | Works in almost every terminal |
\ then Enter | Newline | Universal — most reliable fallback |
Option + Enter | Newline | iTerm2 / Apple Terminal with Option as Meta |
| Paste a multiline block | Preserves newlines | Requires bracketed paste enabled in the terminal |
If Shift + Enter does nothing: run /terminal-setup; if that still fails, use \ + Enter and move on.
Prefer multiline input for staged requirements, log dumps, or checklists. Cramming everything into one line makes it harder for Claude to extract structure.
History and reuse
| Shortcut | What it does |
|---|---|
↑ | Previous history entry (or moves the cursor up inside a multiline edit) |
↓ | Next history entry (or moves the cursor down inside multiline edit) |
Ctrl + R | Reverse-search history |
Ctrl + P / Ctrl + N | Same as ↑ / ↓ |
/resume | Lists resumable sessions to pick from |
Ctrl + R with a keyword is the killer feature. Wrote a 200-line migration prompt earlier? Ctrl + R, type migration, hit Enter. Faster than digging through notes.
Files, commands, and shell
| Input | What it does |
|---|---|
@ + path | References a file or directory; Tab autocompletes |
/ at the start | Opens the command / skill menu |
! at the start | Enters shell mode; the command’s output flows back into context |
# at the start | Writes a memory line (appends to CLAUDE.md or user-level memory) |
| Drag a file onto the terminal | Inserts the file path into the input |
| Paste an image | Most terminals upload it as an image attachment |
@ and Tab are a pair: type @, then a few letters, then Tab — completion walks the directory tree. Much faster than memorizing paths.
! is not just “run a command for me.” It’s “let Claude see the output of this command.” !git status, !npm test, !ls -la dist are the common patterns.
macOS model and mode toggles
These depend on Option being configured as Meta. (iTerm2: Profiles → Keys → “Esc+”; Apple Terminal: Settings → Profiles → Keyboard → “Use Option as Meta key”.)
| Shortcut | What it does |
|---|---|
Option + P | Switch the main model (Opus / Sonnet / Haiku, etc.) |
Option + T | Cycle thinking strength |
Option + O | Toggle fast mode (on supported Opus versions) |
Option + M | Open memory / CLAUDE.md editor |
If a key does nothing, the cause is almost always one of two: Option isn’t set as Meta, or your version doesn’t ship that shortcut. Press ? to confirm.
macOS terminal-level shortcuts
These belong to your terminal app, not Claude Code — but you’ll use them every day while Claude is running. Keep this section close; it removes half the mouse trips.
Universal macOS terminal
| Shortcut | What it does | When to use it |
|---|---|---|
Cmd + C | Copy the selection | Grab Claude’s output, error messages, generated commands |
Cmd + V | Paste | Push logs, code, or links back into Claude |
Cmd + K | Clear screen and scrollback | Start with a clean buffer before reviewing a diff |
Cmd + T | New tab | Run a second claude session, or npm run dev next door |
Cmd + W | Close the current tab or window | Tear down a finished session |
Cmd + N | New terminal window | When you want a separate window, not a tab |
Cmd + 1…Cmd + 9 | Jump to tab N | Multi-session navigation |
Cmd + Shift + [ / ] | Previous / next tab | Walk through tabs in order |
Cmd + + / Cmd + - | Zoom font in / out | Long prompts you can’t read; presenting / sharing screen |
Cmd + 0 | Reset font size | Back to default afterwards |
Cmd + F | Search scrollback | Find earlier Claude output without Ctrl + R |
Cmd + Q | Quit the terminal app | Warning: kills every running claude session at once |
Cmd + H | Hide the terminal | Free the screen while an agent run continues |
Cmd + M | Minimize window | Same idea — clear the screen, keep the run |
Cmd + Tab | Switch apps | Step away while Claude works on a long task |
Cmd + ~ | Cycle through windows of the same app | Multiple terminal windows open |
Fn pressed twice | Start macOS dictation | Dictate a prompt instead of typing it |
Cmd + . | Cancel (some terminals alias this to Ctrl + C) | Occasionally handy in GUI-leaning terminals |
Cmd + K and Ctrl + L both “clear the screen,” but they mean different things: Cmd + K wipes the scrollback (no scrolling back to recover), while Ctrl + L redraws the current frame (history is still there). Use Cmd + K before a diff review, Ctrl + L mid-agent run.
iTerm2 only
| Shortcut | What it does |
|---|---|
Cmd + D | Split pane vertically (left / right) |
Cmd + Shift + D | Split pane horizontally (top / bottom) |
Cmd + Option + ↑ / ↓ / ← / → | Move between split panes |
Cmd + Shift + Enter | Temporarily maximize the focused pane |
Cmd + ; | Autocomplete from command history |
Cmd + Shift + H | Paste history |
Cmd + Option + B | Instant Replay (rewind the terminal) |
Cmd + R | Clear screen (iTerm2 alias) |
Cmd + Shift + S | Save current session to a .txt |
iTerm2 splits are ideal for “Claude on the left, my logs / tests / prompt draft on the right.”
Warp only
| Shortcut | What it does |
|---|---|
Cmd + P | Command Palette |
Cmd + R | Workflow search |
Ctrl + R | Command history search |
Cmd + D / Cmd + Shift + D | Split pane |
Cmd + Enter | AI Command Suggest (when enabled) |
Cmd + Shift + B | Jump to previous block |
Warp’s block mode steps aside for fullscreen interactive UIs like claude. If rendering breaks, run /terminal-setup first; if that doesn’t fix it, disable Warp’s AI input prompt while running Claude Code, or switch to iTerm2.
Apple Terminal only
| Shortcut | What it does |
|---|---|
Cmd + I | Session Inspector (change cursor color, window title, etc.) |
Cmd + S | Save scrollback to a file |
Cmd + Shift + N | New window from current profile |
Cmd + Option + Arrow | Jump between tabs |
Ghostty / Alacritty / Kitty users
These terminals use the same Cmd + <letter> conventions as iTerm2 but with their own defaults. They handle ANSI / true color / Unicode more cleanly, which often means you can skip /terminal-setup entirely. Press Cmd + , to open preferences and check the exact bindings.
Make macOS modifier keys cooperate with Claude Code
If Option + <letter> stops working after switching terminals, 95% of the time the fix is here:
- iTerm2: Settings → Profiles → Keys → “Left/Right Option key” → Esc+.
- Apple Terminal: Settings → Profiles → Keyboard → check Use Option as Meta key.
- VS Code integrated terminal: set
terminal.integrated.macOptionIsMetatotrue. - JetBrains integrated terminal: Settings → Tools → Terminal → check Option as meta key.
- Warp / Ghostty / Kitty: default to treating Option as Meta — usually no change needed.
You don’t have to restart Claude Code after changing this, but you do need a fresh terminal session for the setting to take effect.
VS Code / JetBrains integration
With the Claude Code IDE extension installed:
| Shortcut | What it does |
|---|---|
Cmd + Esc (mac) / Ctrl + Esc (Win/Linux) | Launches or focuses the Claude Code panel |
Cmd + Alt + K / Ctrl + Alt + K | Sends the current selection as a reference into Claude’s input |
Cmd + S in a diff view | Accepts Claude’s edit |
Cmd + Z in a diff view | Reverts the last step |
The real value of the IDE integration is the diff experience and “select code + ask in one sentence” — faster than copy-pasting code into a bare terminal.
Terminal compatibility cheat sheet
Diagnose by symptom:
Shift + Enterdoesn’t insert a newline → run/terminal-setup; fall back to\+Enter.Option + <letter>does nothing → Option isn’t set as Meta in your terminal.- Pasting collapses every newline to a space → enable bracketed paste (iTerm2 on by default; Apple Terminal sometimes disables it).
- Garbled paste → your terminal isn’t using UTF-8.
Ctrl + <letter>swallowed by the system (e.g.Ctrl + Topens a new tab) → switch terminals or unbind the conflicting global shortcut.- IDE integration is dead in JetBrains → confirm the Claude Code plugin is enabled and
claudeis on your PATH.
Drill: build muscle memory
- Week one: force yourself to use just three —
Esc(interrupt),Shift + Tab(mode switch),Ctrl + R(history search). - Week two: add the editing trio —
Ctrl + A,Ctrl + E,Ctrl + W. - Week three: layer in
Esc + Esc(rewind) andCtrl + T(task list). - Then practice
@references,!shell mode, and#memory until “type a long prompt” turns into “pull context inline.”
Don’t try to memorize the whole table day one. Three shortcuts a week, applied to real work, beats ten readings of the cheat sheet.
Quality check
- Are you still clicking the middle of the input box? If yes,
Ctrl + A/Ctrl + Ehaven’t sunk in yet. - Are you still re-prompting a drifting agent instead of rewinding?
Esc + Escone step back usually beats arguing with it. - Is every write still asking for confirmation? Consider
Shift + Tabto auto-accept — but only inside an isolated worktree.
Common mistakes
- Pressing
Ctrl + Ctwice and exiting the session, losing just-generated work —Escis enough to interrupt the turn. - Telling Claude to “write code” in Plan mode, then getting confused when it refuses —
Shift + Tabback to a writeable mode. - Concluding Claude Code is broken when
Option + Pdoes nothing on macOS — 99% of the time it’s Option not being Meta. - Guessing slash commands from memory and getting them wrong — open the
/menu and press?for shortcuts. - Cramming a multi-step request into one line — use
\+EnterorCtrl + Jfor structure.
FAQ
Q: Why does Option+P do nothing in Claude Code on macOS? A: macOS Terminal treats Option as a special key by default, not as Meta. Enable “Use Option as Meta key” in Terminal Profiles or iTerm2 Preferences — then Option+P, Option+B, and friends work.
Q: How do I insert a literal newline without sending the message?
A: Press \ then Enter, or Ctrl+J. Plain Enter submits. This is the single biggest unlock for multi-step requests where structure matters.
Q: Is there a shortcut to switch permission modes mid-session? A: Yes — use the Shift+Tab cycle to move between default, accept-edits, and plan modes without restarting. Useful when you want to flip to read-only review without losing the conversation.
Q: How do I recall a previous prompt without retyping? A: Up arrow walks history one entry at a time; Ctrl+R does reverse-incremental search. Both honor the current session and any persisted history file.
Related
- Every Claude Code Slash Command, Explained
- Claude Code Introduction
- Claude Code Beginner Guide
- Claude Code Workflow
Tags: #Claude #Claude Code #Tutorial