Skip to content

Claude Code Commands Cheat Sheet (2026): Shortcuts and Flags

Terminal flags, slash commands by job, Mac and Windows shortcuts, permission modes, a starter settings.json and what replaced each deprecated command, on one page.

By Yotam DahanUpdated 19 min readClaude Code

Claude Code commands and keyboard shortcuts panel, opened by typing ? in a real Claude Code 2.1.303 session

Claude Code commands come in two kinds: slash commands you type inside a session, such as /clear or /model, and shell commands with flags you type before it starts, such as claude -c. Type / in a session to see every command available to you, or run claude --help in your terminal for every flag. This Claude Code cheat sheet keeps the ones you will actually use, grouped by job, plus shortcuts, custom commands, config file locations and fixes.

How we checked: every entry was compared with Anthropic's commands reference and the docs pages it links to on November 6, 2026, when the newest release was 2.1.318. The screenshots come from Claude Code 2.1.303 on a Mac.

New to the tool? The Claude Code tutorial for beginners shows most of these in action, one step at a time.

The three commands that fix most problems

/clear

Starts a fresh conversation. Use it between unrelated tasks so old context stops confusing Claude and using your plan.

/context

Shows what is filling the context window. Run it when Claude seems to forget earlier details.

/rewind

Opens the rewind menu to restore code, conversation or both. Pressing Esc twice on an empty prompt does the same.

Claude Code commands and CLI flags for your terminal

Type these in Terminal or PowerShell, not inside Claude Code. The full list of Claude Code CLI flags is in the CLI reference.

CommandWhat it does
claudeStart an interactive session in the current folder
claude "your task"Start a session with your first prompt already sent
claude -p "question"Answer once and exit, with no interactive session (print mode)
claude -cContinue the most recent conversation in this folder
claude -rChoose an earlier conversation to resume; claude -r "name" jumps to a named one
claude -n "name"Start a session with a name you can resume by later
claude --model sonnetStart on a specific model, by alias or full name
claude --permission-mode planStart in a specific permission mode
claude --versionShow the installed version
claude updateInstall the newest version now
claude doctorCheck your install and settings without starting a session
claude auth statusShow which account you are signed in with (add --text for plain text)
claude mcp listList your MCP servers and whether each one connects

You never have to memorize flags, because claude --help prints nearly all of them (Anthropic notes a few are left out) and ends with the shell commands. We ran it again on version 2.1.303 on November 6, 2026 and saved the output: 66 flags and 18 subcommands. The table above keeps the 13 you will actually type.

Mac terminal showing claude --version and the Claude Code CLI commands list at the end of claude --help, from agents and doctor to update
A real run on a Mac in October 2026. Your version number will likely be higher; on Windows, run claude --help on its own.

Everyday Claude Code slash commands

Anthropic's full Claude Code commands list had 121 entries on November 6, 2026 (we counted the table): 20 are bundled skills, 1 is a bundled workflow, and which ones you see depends on your plan and platform. These are the ones worth learning first.

Type / and a few letters, and the menu narrows as you type. This is /co in a real session:

Claude Code slash commands menu filtered by typing /co, showing /copy, /color, /config and /compact with descriptions
Each command comes with a one-line description, so you rarely need to memorize the exact name. Real session, October 2026.
CommandWhat it doesReach for it when
/helpShow help and available commandsYou forget a command
/clear [name]Start a new conversation with an empty context; a name labels the old one in /resume (also /new, /reset)You switch to an unrelated task
/compact [focus]Summarize the conversation so far to free spaceA long task is filling the context
/contextShow what is filling the context window, as a colored gridClaude seems to forget earlier details
/resumeReopen an earlier conversation (also /continue)You want yesterday's session back
/rename [name]Name the current sessionYou want to find it again later
/branchSplit off a copy of the conversation to try another directionYou want to experiment without losing the current path
/rewindRoll code and conversation back to an earlier point (also /undo, /checkpoint)A change went wrong
/btw [question]Ask a side question that isn't added to the conversationYou need a quick check mid-task
/copyCopy the last response to the clipboardYou want to paste an answer elsewhere
/export [file]Save the conversation as plain textYou want a record
/recapGet a one-line summary of the session so farYou come back after a break
/exitLeave Claude Code (also /quit)You are done

Claude Code /clear vs /compact: which one should you use?

Use /clear when the next task has nothing to do with the last one, and /compact when you are halfway through one long task and the context is filling up. /clear sets the conversation aside (you can still reopen it with /resume), while /compact replaces it with a summary and carries on.

Add a focus to steer the summary, as in /compact keep the pricing decisions. Your project's CLAUDE.md loads again after either one, so standing rules survive both.

When a task goes wrong, in this order
  1. Esc

    Stop Claude mid-step; the work done so far stays

  2. Type the fix

    Say what to change and Claude carries on from there

  3. Esc twice

    Open the rewind menu and restore code from before the mistake

  4. /clear

    Start over with an empty context if the thread is a mess

Which commands change the model, effort and permissions?

CommandWhat it does
/model [name]Switch model; it becomes your default for new sessions
/effort [level]Set how hard the model thinks: low, medium, high, xhigh, max or auto (max lasts for this session only)
/fastToggle fast mode, a faster Opus at a higher price; on subscription plans it bills to usage credits
/plan [task]Enter plan mode, optionally starting with a task
/permissionsView and edit your allow, ask and deny rules
/configOpen settings (also /settings); /config theme=dark sets one value directly

How to change the model in Claude Code

Type /model to open a picker, or /model sonnet to switch straight away. Pressing s on a row in the picker switches for this session only instead of changing your default, and claude --model opus sets the model before a session starts.

Which commands set up a Claude Code project?

CommandWhat it does
/initGenerate a starter CLAUDE.md file for the project
/memoryOpen and edit your CLAUDE.md files, and switch auto memory on or off
/mcpManage connected MCP servers and their sign-ins
/skillsList the skills available in this session
/pluginBrowse, install and manage plugins
/add-dir <path>Give this session access to another folder
/cd <path>Move the session to another folder and keep the conversation
/keybindingsOpen your keyboard shortcuts file
/terminal-setupAdd Shift+Enter for new lines in VS Code, Cursor, Zed or Alacritty before 0.16; in Apple Terminal it turns off the audible bell and, on macOS 26 or earlier, turns on Option as Meta so Option+Enter adds a new line
/doctorRun a setup checkup that finds problems and offers to fix them

Claude Code commands vs skills

They are now the same thing. Claude Code custom slash commands used to be single Markdown files in .claude/commands/; Anthropic merged these into skills, so .claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy and behave the same. Old command files keep working, but a skill folder can also hold supporting files, and Claude can load a skill on its own when your request matches it.

How to make a custom slash command

Save a prompt you repeat as .claude/skills/follow-up/SKILL.md in your project, and it becomes /follow-up:

markdown
---
description: Draft a client follow-up email from meeting notes
argument-hint: [notes file]
disable-model-invocation: true
---
Read $ARGUMENTS and draft a follow-up email for the client:
one thank-you line, the decisions we made, and next steps with owners and dates.
Save it in drafts/ and never send anything.

Typing /follow-up notes/acme-call.md swaps $ARGUMENTS for the file name ($0 and $1 pick out single words). disable-model-invocation: true makes it run only when you type it, which suits anything that writes or sends.

New skills show up mid-session, except when the .claude/skills folder itself is new: then run /reload-skills, or the command stays missing. Our guide on how to create a Claude skill lists the other frontmatter settings and how to test that a skill triggers, and the Claude Code course for non-coders sets up skills like this one in its 8-minute Skills and MCP lesson.

How do you check Claude's work and your usage?

CommandWhat it does
/diffReview the changes in your working folder, including Claude's edits
/code-reviewReview the current changes for bugs (also /review); add --fix to apply the findings
/security-reviewCheck the changes on your branch for security problems
/usageSee session cost, plan usage limits and activity (also /cost, /stats)
/statusSee version, model, account and which settings files loaded
/insightsGet an HTML report on how you use Claude Code

Which commands handle sign-in, other devices and schedules?

CommandWhat it does
/login and /logoutSign in or out of your Anthropic account
/powerupTake short interactive lessons on Claude Code features
/desktopContinue this session in the desktop app
/remote-controlContinue this session from your phone or a browser (also /rc)
/loop [interval] [prompt]Repeat a prompt on an interval while the session stays open
/scheduleCreate cloud scheduled tasks that run while your computer is off
/goal [condition]Keep Claude working across turns until a condition is met

Or ask Claude Code itself:

Ask Claude Code about its own commands
I'm about to [TASK]. Which slash commands, shortcuts or settings would help me most? Explain each one in a single line and tell me when not to use it.

Claude Code keyboard shortcuts (Mac and Windows)

From the interactive mode reference. Mac and Windows keys are the same unless noted.

ShortcutWhat it does
EscStop Claude mid-step (it keeps the work done so far); close a dialog
Esc twiceWith an empty prompt, open the rewind menu; with text, clear the draft
Shift+TabCycle permission modes
Ctrl+CInterrupt; with nothing running, first press clears the prompt, second press exits
Ctrl+DPress twice on an empty prompt to exit
Up and Down arrowsBrowse your earlier prompts
Ctrl+RSearch your prompt history
TabAccept an autocomplete suggestion
Ctrl+OShow the full transcript, with every tool call
Ctrl+TShow or hide Claude's task checklist
Ctrl+BMove a running command to the background
Ctrl+GOpen your prompt, or a proposed plan, in your text editor
Ctrl+SStash the current draft; press again on an empty prompt to bring it back
Ctrl+Shift+- (also Ctrl+_)Undo your last edit to the prompt text, such as text you deleted by mistake
Ctrl+Z (Mac and Linux)Suspend Claude Code and return to your shell; type fg to come back
Ctrl+V (Cmd+V in iTerm2, Alt+V on Windows)Paste an image from the clipboard
Option+P (Mac) or Alt+PSwitch model without losing your draft
Option+T (Mac) or Alt+TToggle extended thinking, on models where it can be switched off
Option+O (Mac) or Alt+OToggle fast mode
? on an empty promptShow the shortcut help panel

In the desktop app, Shift+Tab doesn't cycle modes, so use the mode selector instead. Press Cmd+/ on a Mac or Ctrl+/ on Windows to see the app's own shortcuts.

Claude Code shortcuts: Mac Option key setup

Check your keyboard layout first. We read macOS's own layout data on November 6, 2026: on the Spanish layout @ is Option+2, on Latin American it is Option+Q, and on French AZERTY \ is Shift+Option+:, so with Option as Meta those keys stop typing. In iTerm2, set only the left Option key to "Esc+"; in Apple Terminal, leave it off and use /model, /fast and Ctrl+J instead.

Claude Code shortcuts in VS Code

The VS Code extension adds its own keys on top:

MacWindowsWhat it does
Cmd+EscCtrl+EscJump between your file and Claude's prompt box
Cmd+Shift+EscCtrl+Shift+EscOpen a new conversation in an editor tab
Option+KAlt+KInsert an @-mention of the file and lines you have selected
Ctrl+Option+FCtrl+Alt+FHide or show tool activity in the conversation

If Cmd+Esc does nothing on macOS Tahoe or later, the system's Game Overlay shortcut is catching it: switch that off in System Settings under Keyboard, Keyboard Shortcuts, Game Controllers, or rebind Claude Code: Focus input in VS Code.

What do /, ! and @ do in a prompt?

Type thisWhat happens
/ at the startRun a command or skill
! at the startRun a shell command yourself; the output goes into the conversation and Claude responds to it
@Mention a file or folder, with path autocomplete

Claude Code new line: how to add one without sending

Enter sends your message. For a new line, press Ctrl+J, or type \ and then press Enter: both work in every terminal with no setup. Shift+Enter depends on your terminal, according to Anthropic's terminal configuration page (checked November 22, 2026):

TerminalShift+Enter for a new line
iTerm2, Ghostty, Kitty, WezTerm, Warp, Windows Terminal 1.25 or laterWorks with no setup
Alacritty 0.16 or later, foot and other terminals with the kitty keyboard protocolWorks with no setup on Claude Code 2.1.269 or later
VS Code, Cursor, Zed, Alacritty before 0.16Run /terminal-setup once
Apple Terminal (Mac)Not on the list: use Option+Enter once Option as Meta is on (Settings, Profiles, Keyboard; /terminal-setup switches it on only on macOS 26 or earlier)
Windows Terminal before 1.25, gnome-terminal, JetBrains IDEsNot available: use Ctrl+J or \ then Enter

Permission modes at a glance

Shift+Tab moves through the modes, and the line under the prompt box always tells you which one you are in. These are the four lines from a real session:

Claude Code status line in each permission mode: manual mode on, accept edits on, plan mode on and auto mode on
Pressing Shift+Tab three times from Manual. Check this line before you send anything that changes files.
The status line showsModeRuns without asking
⏸ manual mode onManual (config value default)Reads only
⏵⏵ accept edits onacceptEditsReads, file edits and common file commands such as mkdir and mv
⏸ plan mode onplanReading and exploring; no edits until you approve a plan
⏵⏵ auto mode onautoMost actions, with a background safety check; the starting mode in current versions

What does --dangerously-skip-permissions do?

The Claude Code --dangerously-skip-permissions flag starts a session in bypassPermissions mode, so it stops asking before almost anything, and Claude Code's own help text recommends it only for sandboxes with no internet access. Deny rules still block, and a few actions, such as deleting your whole home folder, never run unasked. On your own computer, use auto mode instead: it removes most prompts but keeps the background safety checks.

Where is the Claude Code config file?

The Claude Code config file location depends on who a setting is for. ~ means your home folder, ~/.claude is a hidden folder inside it, and a plain .claude means the folder inside your project. On Windows, ~ is %USERPROFILE%, so your personal settings file is %USERPROFILE%\.claude\settings.json. Details are in the official settings guide.

FileApplies toWhat it holds
~/.claude/settings.jsonYou, in every projectPersonal settings: theme, default model, your own permission rules
.claude/settings.jsonEveryone in the projectShared permissions, hooks and plugins; commit it to share it
.claude/settings.local.jsonYou, in this projectPersonal overrides; "Yes, and don't ask again" approvals are saved here
~/.claude.jsonYouSign-in state, your MCP servers, folder trust; Claude Code maintains it for you
~/.claude/CLAUDE.mdYou, in every projectPersonal instructions
CLAUDE.md or .claude/CLAUDE.mdThe projectProject instructions
CLAUDE.local.mdYou, in this projectPrivate project notes; add it to .gitignore
.claude/rules/*.mdThe projectInstructions split by topic, optionally only for certain files
.claude/skills/<name>/SKILL.mdThe project (or ~/.claude/skills/ for you)Skills you run with /name
.mcp.jsonThe projectMCP servers shared with the team
~/.claude/keybindings.jsonYouCustom keyboard shortcuts
~/.claude/projects/<project>/memory/You, per projectAuto memory: notes Claude writes for itself

When the same setting appears in several files, the highest one wins: settings your company manages beat everything, and your user file in ~/.claude is the fallback.

Lists such as permission rules are combined across files instead of replaced, and a deny rule anywhere beats an allow rule anywhere. What belongs inside the CLAUDE.md files has its own guide: the CLAUDE.md file explained.

A starter Claude Code settings.json

Save this as .claude/settings.json in a project, or as ~/.claude/settings.json to apply it everywhere:

json
{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "permissions": {
    "defaultMode": "default",
    "deny": [
      "Read(./.env)",
      "Read(./.env.*)",
      "Read(./secrets/**)"
    ]
  }
}

"defaultMode": "default" makes new terminal sessions start in Manual mode, so Claude asks before each edit and command. The deny rules stop Claude's file tools from reading environment files, where passwords and keys usually live, and anything in a secrets folder.

Rather not edit JSON by hand? Run /update-config and describe the change, such as "never let Claude read my .env file", and Claude edits the right settings file for you. Claude Code reloads most settings edits automatically, and /status shows which files loaded. This guide's free bonus has three more rule sets to paste, for secrets, an npm website and a writing folder.

Claude Code deprecated commands and what replaced them

Older tutorials still mention commands and flags that have since been removed or changed. Here is what to use now:

Old commandWhat happenedUse this now
/vimRemoved in version 2.1.92Editor mode in /config
/pr-commentsRemoved in version 2.1.91Ask Claude to read the pull request comments
/ultraplanRemovedPlan mode: /plan or Shift+Tab
/agentsNo longer opens a menu, only a reminderAsk Claude to create a subagent, or edit .claude/agents/
/routinesRenamed, still works as an alias/schedule
/extra-usageRenamed/usage-credits
/review as a separate pull request reviewAn alias of /code-review since version 2.1.223/code-review, or /code-review 1234 for pull request 1234
claude --enable-auto-modeRemoved in version 2.1.111claude --permission-mode auto, or Shift+Tab

Claude Code error messages and the command that fixes each

When the last change went wrong, press Esc twice on an empty prompt. Claude Code lists your earlier messages with how many files each one changed:

Claude Code rewind menu after pressing Esc twice, listing an earlier message with 3 files changed +71 -8
Pick the message to go back to, then choose to restore the code, the conversation or both.

These messages come from Anthropic's error reference and settings docs.

What you seeWhat it meansFix
Unknown command: /hepl. Did you mean /help?A typo, or a command from a plugin or MCP server that isn't connectedType / and pick from the filtered menu; check /plugin or /mcp
Context limit reached · /compact or /clear to continueThe conversation filled the context window/compact to keep going on the same task, /clear for a new one
A Settings Error dialog at startupA settings file has invalid JSON, such as a trailing commaLet Claude fix it from the dialog, or fix the file and run claude doctor to see each error
Invalid permission rule "Bash(ls) x" was skippedA permission rule is malformedWrite it as Tool or Tool(content), ending at the closing parenthesis
You edited CLAUDE.md and Claude ignores the changeCLAUDE.md loads at the start of each conversationRun /clear, then /context to check it is listed under Memory files
Claude Code misbehaves after you added a plugin, hook or skillOne customization is brokenStart with claude --safe-mode, which switches them all off, then add them back one at a time

When long sessions start eating into your plan, the guide to Claude Code usage limits shows which of these commands stretch it furthest. If claude itself isn't found, the install Claude Code guide has the PATH fix for Mac and Windows.

Quick check0 of 3 correct

Which command starts a fresh conversation when you switch to an unrelated task?

Where do your personal settings for every project live?

Your team's .claude/settings.json allows a command and your user settings deny it. What happens?

What to do next

Print this page or keep it pinned, and learn three commands a week instead of all of them at once, starting with /clear, /context and /rewind. Then run /powerup for Anthropic's short built-in lessons, and turn the first prompt you catch yourself retyping into a custom command.

If you would rather learn them while building something real, ai school's Claude Code course for non-coders, now in early access, has an 8-minute lesson on the shortcuts that save the most time and then puts them to work on research, a landing page and an agent. It suits people who start from zero and want guided projects; if you already use Claude Code every day and only came for the right command, this page and Anthropic's docs are enough. We sell that course, and everything on this page works without it.

Permission rule sets, a starter CLAUDE.md and 10 fixes

Three paste-ready permission rule sets (secrets, an npm website, a writing folder), a starter CLAUDE.md for a non-coder project, ten 'when this happens, type this' fixes and a five-day drill.

Enter your email and the full section opens right here.

No spam. One click to unsubscribe. We use your email to send you this bonus, new guides and news about our courses.

Frequently asked questions

Why don't I see some of these commands?

Some commands depend on your platform, plan or setup. For example, /desktop only appears on macOS and x64 Windows when you sign in with a Claude subscription, and /upgrade doesn't show on Enterprise plans. If a newer command is missing everywhere, run claude update.

Is there a Claude Code cheat sheet PDF?

To keep this page as a PDF, press Cmd+P on a Mac or Ctrl+P on Windows and choose Save as PDF. The free bonus adds what the page leaves out: three permission rule sets to paste, a starter CLAUDE.md, ten 'when this happens, type this' fixes and a five-day practice drill.

Can I change the keyboard shortcuts?

Yes. Run /keybindings to create or open ~/.claude/keybindings.json, where you can rebind or switch off most actions, and changes apply without a restart. A few keys are reserved and can't be rebound, including Ctrl+C (interrupt) and Ctrl+D (exit).

Do slash commands work in the VS Code extension?

Most do. The extension supports a subset of commands and skills (type / in its prompt box to see them), while the ! shell prefix and Tab completion only work in the terminal. For anything missing, run claude in VS Code's integrated terminal, which needs the standalone install.

Where are my Claude Code conversations stored?

On your own computer, as plain-text files under ~/.claude/projects/, deleted after 30 days by default; the cleanupPeriodDays setting changes that. Running claude purge deletes everything Claude Code has stored for one project.

Keep reading