The basics worth memorizing: shortcuts, prefixes, in-session slash commands, and shell CLI - not the full /commands list, just what you reach for daily. Keyboard shortcuts are described in prose, not boxed in code; the collapsible “Example” blocks only show up where there’s an actual string worth copy-pasting.
If you want the full control surface, see Claude Code tools and Claude Code plan mode for the workflow mechanics that make these shortcuts pay off. For why /compact and /clear beat buying a bigger window, see Prune the log, not the window.
Cheatsheet layout
Jump to a section:
- Command cheatsheet - keys you hit when things stall (
Ctrl+C,Esc,Ctrl+R,Ctrl+O,Ctrl+G). - Shortcuts & prefixes -
/for commands,!for shell mode,@for file mentions,\\ + Enterfor multiline,Shift+Tabfor permission modes. - Claude (shell) commands - start, continue, or script a session from your terminal.
- Claude commands - slash commands inside an open session.
- Session commands - context, compaction, memory, config, permissions.
- Context & memory - hooks, MCP, subagents.
- Splitting a session - the four commands that all sound like “copy this conversation”.
- Removed commands - what older guides still tell you to type.
Command cheatsheet (when you’re stuck)
Ctrl+C
- Interrupts a running operation.
- If nothing is running: first press clears input, second press exits.
Esc
- Interrupts Claude mid-response / mid-tool-call so you can redirect.
- If a dialog is open (permissions / menus),
Esccloses the dialog instead.
Esc then Esc
- If there’s text in the input: clears the draft (it’s saved; press Up to bring it back).
- If the input is empty: opens the rewind menu.
Ctrl+R
Reverse-search your input history.
Ctrl+O
Toggles the transcript viewer: the tool calls, timestamps, and per-message model that the normal view collapses. This is where you look when the summary of what happened doesn’t match what actually happened - including MCP calls that otherwise show up as “Called slack 3 times”.
Ctrl+G
Opens your prompt - or the plan Claude just proposed - in $EDITOR. The most underused key in the
tool: a long, structured first prompt is much easier to write in a real editor than in a terminal
input, and editing the plan is faster than arguing with it in chat.
Shortcuts & prefixes
Slash commands: /…
Start your input with / to run a command (or invoke a skill).
Shell mode: !…
Prefix with ! to run a shell command; its output is added to the session.
Example
!git status
Multiline input: \\ + Enter
Works everywhere. It’s the portable “new line”.
Example
First line\
Second line
File mentions: @
Type @ for path autocomplete and file mentions.
Example
read @src/content/articles/claude-code-tools.md and summarize the key rules
Permission modes: Shift+Tab
Cycle permission modes (default - manual approval, acceptEdits, plan, plus any enabled extras).
Claude (shell) commands
These run in your normal terminal. They control how a session starts.
claude
Starts an interactive session.
claude "query"
Starts interactive mode with an initial prompt.
Example
claude "explain what this repo does and where the entrypoints are"
claude -p "query"
Print mode: runs non-interactively, then exits.
Example
claude -p "summarize the last 20 lines of this log" --output-format text
claude -c
Continues the most recent conversation in the current directory.
claude --add-dir ../path
Grants file access to additional directories.
Example
claude --add-dir ../shared
claude --resume / claude -r "<session>" "query"
Opens the session picker, or resumes one directly by ID or name.
claude --worktree [name]
Starts the session in an isolated git worktree, so two sessions can’t overwrite each other’s edits.
Add --tmux to launch it in its own tmux session.
Example
claude --worktree oauth --name oauth-migration
claude --name "<name>"
Names the session up front, so --resume lists workstreams instead of timestamps. /rename does
the same mid-session.
claude --max-budget-usd <n>
Stops the run after it has spent that much - subagent spend included. The cheapest insurance in the
CLI, but print mode only: it bounds claude -p runs and does nothing in an interactive session.
Example
claude -p "fix the failing auth tests" --max-turns 20 --max-budget-usd 2
claude --safe-mode / claude --bare
--safe-mode disables every customization - the baseline you compare against when something is
broken and you suspect your own configuration. --bare skips auto-discovery for the fastest
possible start.
Claude commands (inside a session)
The official list is huge. These are the daily drivers.
/help
Shows help and available commands.
/usage (aliases: /cost, /stats)
Shows usage/cost and activity stats (and, on paid plans, breakdowns by skills/tools/plugins/MCP).
/export [filename]
Exports the current conversation as plain text.
Example
/export notes.txt
/clear (aliases: /reset, /new)
Starts a new conversation with empty context; the previous one stays available in /resume.
Example
/clear "before-refactor"
/exit (alias: /quit)
Exits the CLI.
/status
Opens the Status tab in Settings (version, model, account, connectivity).
/rewind (aliases: /checkpoint, /undo)
Rewinds code and/or conversation to a previous point, or summarizes from a selected message.
/plan [description]
Enters plan mode (optionally with a task description).
Example
/plan refactor src/lib/ without changing behavior
/doctor
Diagnoses and verifies your Claude Code installation and settings (and can offer to fix issues): duplicate installs, PATH problems, unparseable settings, slow hooks, and unused skills, MCP servers, and plugins measured against what they cost you in context. It reports first and changes nothing without confirmation.
/resume [session] (alias: /continue)
Returns to an earlier conversation by ID, by name, or from the picker. Background sessions show up
marked bg; a running one has to be attached or stopped from claude agents first.
/rename [name]
Names the current session and shows it on the prompt bar. Without a name, it generates one from the conversation.
/diff
Interactive viewer for uncommitted changes and per-turn diffs - left/right switches between the git diff and what each individual turn changed.
/code-review [level] [--fix] [--comment]
Reviews the current diff in a fresh subagent for correctness bugs and cleanup opportunities.
--fix applies the findings, --comment posts them as inline PR comments. Its sibling /simplify
runs four parallel agents on reuse, simplification, efficiency, and level of abstraction - and
deliberately does not look for bugs, which is what /code-review is for.
/btw [question]
Asks a side question in an overlay that never enters conversation history. Use it for “what does this flag do again?” mid-task instead of spending permanent context on it.
/copy [N]
Copies the last assistant response; /copy 2 takes the one before it. When code blocks are present
you get a picker - press w to write the selection to a file instead of the clipboard, which is how
you get output off a remote box over SSH.
Session commands
/context
Shows context usage as a colored grid, with optimization suggestions and - when the conversation has run past the window - the exact number you’re over by. Run it before you optimize anything.
/compact [instructions]
Summarizes the conversation to free context window space. Run it at roughly 60% of the window rather than waiting for the automatic compaction at the limit, which tends to fire mid-task and summarize away the constraints you set at the start.
Example
/compact keep only decisions, file paths, and open questions
/model and /effort [level]
/model switches model and saves it as your default; press s on a row to switch for this session
only. /effort sets the token-spend dial - low, medium, high, xhigh, max, ultracode, or
auto to reset to the model default. Both apply immediately, without waiting for the current
response to finish.
/skills
Lists available skills. Press t to sort by token count - the fastest way to find what’s
inflating your startup - and Space to cycle a skill’s visibility. /reload-skills re-scans the
directories so edits you make on disk apply without restarting.
/init
Initializes a repo with a starter CLAUDE.md.
/memory
Edits/views CLAUDE.md memory files and auto-memory entries.
/config (alias: /settings)
Opens settings (or sets keys via key=value).
Example
/config theme=dark
/permissions (alias: /allowed-tools)
Manages allow/ask/deny rules for tool permissions.
Context & memory
/hooks
Shows hook configurations for tool events.
/mcp
Manages MCP server connections and authentication.
/agents
Points you at your subagent configurations. From v2.1.198 it prints a reminder to ask Claude to
create or manage them, or to edit .claude/agents/ and ~/.claude/agents/ directly; earlier
versions opened an interactive editor.
/tasks
Lists background work in the current session - running shell commands and subagents, finished ones
included. Also available as /bashes.
/insights
Generates a report over your own session history: which project areas you spend time in, how you interact, and where the friction is. It’s the evidence for what to fix in your setup, rather than a guess.
Splitting a session
Four commands sound like “copy this conversation” and do four different things. Pick by where you end up, not by the verb.
| Command | Where the copy runs | Where you end up |
|---|---|---|
/branch | Foreground, same terminal | You move into the branch; the original waits |
/fork | Background, independent | You stay; the copy never reports back |
/subtask | Background subagent | You stay; the result lands in this conversation |
/background | This session, detached | Terminal freed; monitor with claude agents |
/subtask is the one you want when the answer matters to what you’re doing now; /fork is the one
you want when it doesn’t. Both need v2.1.212 or later - on builds between v2.1.161 and v2.1.211,
/fork behaves like today’s /subtask.
Removed commands
Two commands still turn up in guides written against older builds:
/vim- removed in v2.1.92. Toggle Vim editing from/config→ Editor mode, or seteditorMode: "vim"in settings./pr-comments- removed in v2.1.91. Ask Claude to read the PR comments directly, or use/code-review --commentto write them.
Which is the general lesson: the tool ships several releases a week, so /help is the authoritative
list for the build you actually have, and /release-notes tells you when something changed.
Bottom line
If you only memorize a few: Esc interrupts, Esc Esc rewinds, /export saves, /rewind restores, /context tells you what’s filling the window.
Related notes: effort vs fast mode, plan mode decision tree, verify before done.
Three habits turn that into a workflow. Compact at around 60% of the window rather than at the
limit. Reach for /rewind instead of stacking “that didn’t work, try this instead” on top of a
context that now contains the failed attempt as an example. And name every session, so /resume is
a list of workstreams rather than a wall of timestamps.