Every Claude Code Keyboard Shortcut, Explained

A complete reference for every Claude Code keyboard shortcut: session control, permission modes, input editing, history, IDE integration, and terminal compatibility.

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 + Enter doesn’t insert a newline, run /terminal-setup so 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

ShortcutWhat it doesWhen to use it
?Shows the active shortcut helpWhen you forgot a key, switched terminals, or just installed
Ctrl + CCancels current input; twice in a row exits the sessionTo clear the input box, or to fully exit
Ctrl + DExits when the input is emptyOne keystroke instead of Ctrl + C twice
EscInterrupts Claude’s current reply or tool callTo redirect without losing finished work
Esc then EscOpens the rewind / checkpoint menuTo return to an earlier tool call or undo a code / conversation state
Ctrl + LRedraws the terminal screenWhen output looks stale or is overwritten by external logs
Ctrl + ZSuspends the entire Claude process to backgroundTo pop back to the shell briefly; bring it back with fg
Ctrl + BBackgrounds the running taskWhen a long agent run shouldn’t block the main UI
Ctrl + TShows / hides the task listTo 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

ShortcutWhat it does
Shift + TabCycles 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.

ShortcutWhat it does
Ctrl + AJump to start of line
Ctrl + EJump 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 + KDelete from cursor to end of line
Ctrl + UDelete from cursor to start of line
Ctrl + WDelete previous word
Alt + DDelete next word
Ctrl + H / BackspaceDelete previous character
Ctrl + YYank back the most recently deleted text (kill ring)
Ctrl + T in inputSwap 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

InputWhat it doesCompatibility
Shift + EnterNewlineMost modern terminals once configured
Ctrl + JNewlineWorks in almost every terminal
\ then EnterNewlineUniversal — most reliable fallback
Option + EnterNewlineiTerm2 / Apple Terminal with Option as Meta
Paste a multiline blockPreserves newlinesRequires 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

ShortcutWhat 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 + RReverse-search history
Ctrl + P / Ctrl + NSame as /
/resumeLists 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

InputWhat it does
@ + pathReferences a file or directory; Tab autocompletes
/ at the startOpens the command / skill menu
! at the startEnters shell mode; the command’s output flows back into context
# at the startWrites a memory line (appends to CLAUDE.md or user-level memory)
Drag a file onto the terminalInserts the file path into the input
Paste an imageMost 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”.)

ShortcutWhat it does
Option + PSwitch the main model (Opus / Sonnet / Haiku, etc.)
Option + TCycle thinking strength
Option + OToggle fast mode (on supported Opus versions)
Option + MOpen 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

ShortcutWhat it doesWhen to use it
Cmd + CCopy the selectionGrab Claude’s output, error messages, generated commands
Cmd + VPastePush logs, code, or links back into Claude
Cmd + KClear screen and scrollbackStart with a clean buffer before reviewing a diff
Cmd + TNew tabRun a second claude session, or npm run dev next door
Cmd + WClose the current tab or windowTear down a finished session
Cmd + NNew terminal windowWhen you want a separate window, not a tab
Cmd + 1Cmd + 9Jump to tab NMulti-session navigation
Cmd + Shift + [ / ]Previous / next tabWalk through tabs in order
Cmd + + / Cmd + -Zoom font in / outLong prompts you can’t read; presenting / sharing screen
Cmd + 0Reset font sizeBack to default afterwards
Cmd + FSearch scrollbackFind earlier Claude output without Ctrl + R
Cmd + QQuit the terminal appWarning: kills every running claude session at once
Cmd + HHide the terminalFree the screen while an agent run continues
Cmd + MMinimize windowSame idea — clear the screen, keep the run
Cmd + TabSwitch appsStep away while Claude works on a long task
Cmd + ~Cycle through windows of the same appMultiple terminal windows open
Fn pressed twiceStart macOS dictationDictate 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

ShortcutWhat it does
Cmd + DSplit pane vertically (left / right)
Cmd + Shift + DSplit pane horizontally (top / bottom)
Cmd + Option + ↑ / ↓ / ← / →Move between split panes
Cmd + Shift + EnterTemporarily maximize the focused pane
Cmd + ;Autocomplete from command history
Cmd + Shift + HPaste history
Cmd + Option + BInstant Replay (rewind the terminal)
Cmd + RClear screen (iTerm2 alias)
Cmd + Shift + SSave current session to a .txt

iTerm2 splits are ideal for “Claude on the left, my logs / tests / prompt draft on the right.”

Warp only

ShortcutWhat it does
Cmd + PCommand Palette
Cmd + RWorkflow search
Ctrl + RCommand history search
Cmd + D / Cmd + Shift + DSplit pane
Cmd + EnterAI Command Suggest (when enabled)
Cmd + Shift + BJump 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

ShortcutWhat it does
Cmd + ISession Inspector (change cursor color, window title, etc.)
Cmd + SSave scrollback to a file
Cmd + Shift + NNew window from current profile
Cmd + Option + ArrowJump 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.macOptionIsMeta to true.
  • 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:

ShortcutWhat it does
Cmd + Esc (mac) / Ctrl + Esc (Win/Linux)Launches or focuses the Claude Code panel
Cmd + Alt + K / Ctrl + Alt + KSends the current selection as a reference into Claude’s input
Cmd + S in a diff viewAccepts Claude’s edit
Cmd + Z in a diff viewReverts 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:

  1. Shift + Enter doesn’t insert a newline → run /terminal-setup; fall back to \ + Enter.
  2. Option + <letter> does nothing → Option isn’t set as Meta in your terminal.
  3. Pasting collapses every newline to a space → enable bracketed paste (iTerm2 on by default; Apple Terminal sometimes disables it).
  4. Garbled paste → your terminal isn’t using UTF-8.
  5. Ctrl + <letter> swallowed by the system (e.g. Ctrl + T opens a new tab) → switch terminals or unbind the conflicting global shortcut.
  6. IDE integration is dead in JetBrains → confirm the Claude Code plugin is enabled and claude is on your PATH.

Drill: build muscle memory

  1. Week one: force yourself to use just three — Esc (interrupt), Shift + Tab (mode switch), Ctrl + R (history search).
  2. Week two: add the editing trio — Ctrl + A, Ctrl + E, Ctrl + W.
  3. Week three: layer in Esc + Esc (rewind) and Ctrl + T (task list).
  4. 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 + E haven’t sunk in yet.
  • Are you still re-prompting a drifting agent instead of rewinding? Esc + Esc one step back usually beats arguing with it.
  • Is every write still asking for confirmation? Consider Shift + Tab to auto-accept — but only inside an isolated worktree.

Common mistakes

  • Pressing Ctrl + C twice and exiting the session, losing just-generated work — Esc is enough to interrupt the turn.
  • Telling Claude to “write code” in Plan mode, then getting confused when it refuses — Shift + Tab back to a writeable mode.
  • Concluding Claude Code is broken when Option + P does 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 \ + Enter or Ctrl + J for 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.

Tags: #Claude #Claude Code #Tutorial