Guides
Claude Code commands: slash commands and keyboard shortcuts cheat sheet
This page is a quick reference for the slash commands and keyboard shortcuts you reach for every day in Claude Code, ordered by the flow of a session: setting up a project, working on a task, managing context, then reviewing and troubleshooting. Command names, aliases and behavior come from Anthropic's Commands and Interactive mode docs, checked on October 30, 2026. The tables are a selection; the full list is in those docs.
- Type
/to list the commands available to you, and keep typing letters to filter. A command is only recognized at the start of your message. - The ones you will use most:
/initcreates aCLAUDE.md,/compactsummarizes the conversation,/clearstarts a new one,/resumereturns to an old one, and/rewindrolls back code and conversation. Shift+Tabcycles permission modes,Escinterrupts Claude, andEsc+Escon an empty prompt opens the rewind menu.- Not every command appears for every user: it depends on your platform, plan and environment. Limits the docs state are kept below.
Starting a project and working on a task
In a repo for the first time, run /init and then refine the result with /memory. Before a large change, /plan switches into plan mode.
| Command | What it does |
|---|---|
/init | Initializes the project with a CLAUDE.md guide. Set CLAUDE_CODE_NEW_INIT=1 for an interactive flow that also walks through skills, hooks and personal memory files. See writing a CLAUDE.md |
/memory | Edits CLAUDE.md files, turns auto memory on or off, and shows auto memory entries |
/plan [description] | Enters plan mode from the prompt. Add a description to start on that task right away, for example /plan fix the auth bug |
/model [model] | Switches the model and saves it as your default for new sessions. With no argument it opens a picker, where s on a row switches for the current session only. See choosing a model |
/effort [level|auto|status|ultracode [on|off]] | Sets the effort level: low to xhigh, max, or auto; status prints it. max is session-only |
/btw [question] | Asks a side question without adding to the conversation |
/add-dir <path> | Adds a working directory for file access during the session. Type a partial path to see suggestions and press Tab to accept one. Most .claude/ configuration isn't discovered from the added directory |
/tasks | Views and manages background work in the current session, including subagents that have finished. Also available as /bashes |
Context and sessions
| Command | What it does |
|---|---|
/context [all] | Shows context usage as a colored grid, with suggestions for context-heavy tools and memory bloat. In fullscreen mode the per-item breakdown is collapsed; pass all to expand it |
/compact [instructions] | Frees up context by summarizing the conversation so far. Optionally pass focus instructions for the summary |
/clear [name] | Starts a new conversation with empty context. Pass a name to label the previous conversation in the /resume picker. To free context and keep the same conversation, use /compact. Aliases: /reset, /new |
/resume [session] | Resumes a conversation by ID or name, or opens the session picker. Alias: /continue |
/rewind | Rewinds the conversation and/or code to a previous point, or summarizes from a selected message. Aliases: /checkpoint, /undo |
/usage | Shows session cost, plan usage limits and activity stats. /cost and /stats are aliases. For ways to spend less, see spending fewer tokens |
Review, settings and troubleshooting
| Command | What it does |
|---|---|
/diff | Reviews the changes in your working tree, including the edits Claude has made so far |
/code-review | Checks the current diff for correctness bugs. Pass --fix to have Claude apply the findings, or a PR number to review a pull request, such as /code-review high 1234. /code-review ultra runs a multi-agent review in the cloud. Alias: /review |
/security-review | Analyzes the changes on your current branch for security vulnerabilities. Needs an origin remote |
/permissions | Manages allow, ask and deny rules for tool permissions in an interactive dialog: view rules by scope, add or remove them, manage working directories. Alias: /allowed-tools |
/config [key=value ...] | Opens the Settings interface for theme, model, output style and more. Pass pairs to set a setting directly, such as /config model=sonnet; /config --help lists the keys it accepts. Alias: /settings |
/status | Opens the Settings interface on the Status tab, showing version, model, account and connectivity. Works while Claude is responding |
/doctor | Runs a setup checkup that diagnoses installation, settings, extension and CLAUDE.md problems and proposes fixes that Claude applies after you confirm. Alias: /checkup |
/terminal-setup | Installs a Shift+Enter keybinding for newlines in VS Code, Cursor, Devin Desktop, Alacritty or Zed. In Apple Terminal it enables Option+Enter for newlines and turns off the audible bell instead |
A few commands are limited by plan or platform: /desktop only shows on macOS and x64 Windows when signed in with a Claude subscription, and /upgrade doesn't show on Enterprise plans. Also, /vim was removed in v2.1.92; to switch between Vim and Normal editing modes, use /config and then Editor mode.
Keyboard shortcuts
The shortcuts below come from the General controls table in the Interactive mode doc. On macOS, Option or Alt shortcuts such as Alt+B, Alt+F, Alt+D, Alt+Y and Alt+P need Option configured as Meta in your terminal first.
| Shortcut | What it does |
|---|---|
Ctrl+C | Interrupts a running operation. If nothing is running, the first press clears the prompt and a second press exits Claude Code |
Esc | Stops the current response or tool call mid-turn; Claude keeps the work done so far. Closes an open dialog, and declines the action on a permission prompt |
Esc + Esc | With text in the prompt, clears it and saves the draft to history so Up recalls it. With an empty prompt, opens the rewind menu |
Shift+Tab | Cycles permission modes: default (labeled Manual in the mode indicator), acceptEdits, plan, and, when available, bypassPermissions and then auto. On some Windows setups it is Alt+M |
Ctrl+O | Toggles the transcript viewer, which shows detailed tool usage and execution |
Ctrl+R | Reverse-searches your command history |
Ctrl+B | Backgrounds running Bash commands and agents. Tmux users press twice |
Ctrl+G or Ctrl+X Ctrl+E | Opens your prompt in your default text editor |
Ctrl+V (Cmd+V in iTerm2, Alt+V on Windows and WSL) | Pastes an image from the clipboard and inserts an [Image #N] chip at the cursor, so you can reference it by position in your prompt |
Option+P (macOS) or Alt+P (Windows/Linux) | Switches the model without clearing your prompt |
Option+T (macOS) or Alt+T (Windows/Linux) | Toggles extended thinking. It has no effect on Opus 5.5, Sonnet 5.5, Haiku 5.5 or the Fable models, which always use extended thinking |
Newlines and input prefixes
| Input | What it does |
|---|---|
\ + Enter | Inserts a newline; works in all terminals |
Shift+Enter | Inserts a newline. Native in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal; for other terminals, see /terminal-setup above |
Ctrl+J | Inserts a newline; works in any terminal without configuration |
! at the start | Shell mode: runs a command directly, adds its output to the session, and has Claude respond to it |
@ | File path mention; triggers path autocomplete |
? on empty input | Toggles the shortcut help panel |
! npm test
! git status
A shell-mode command doesn't need Claude to interpret or approve it, and its output goes into the conversation context. Claude then responds to the output automatically, at the same cost as sending a normal prompt.
Launch flags mentioned in these docs
The full list of launch flags is in the CLI reference. These two pages mention only a couple:
claude --debug # start with debug logging on
claude --settings file.json # apply this settings file to this session only
To turn on debug logging partway through a session, run /debug; it starts capturing logs from that point forward.
FAQ
I get "Unknown command". What is going on?
Usually either a typo, or the command isn't available for your platform, plan or environment. After a typo the menu highlights nothing and Enter submits your text as typed, which reports Unknown command; unavailable commands don't appear in the menu at all. For similar messages, see troubleshooting errors.
Can I send a command while Claude is responding?
Yes. Claude Code queues it and runs it after the current turn finishes. Some commands, such as /status, /tasks and /usage, run immediately without interrupting the response.
My Option shortcuts do nothing on macOS. Why?
Your terminal needs Option configured as Meta; Anthropic's terminal config guide has the setting for each terminal. The doc notes that Option+T is the exception and works without it.
Sources
- Claude Code: Commands (slash commands, aliases, plan and platform limits)
- Claude Code: Interactive mode (keyboard shortcuts, multiline input, shell mode, queued messages)
- Claude Code: CLI reference (the full list of launch flags)