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 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.
/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.
| Command | What it does |
|---|---|
claude | Start 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 -c | Continue the most recent conversation in this folder |
claude -r | Choose 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 sonnet | Start on a specific model, by alias or full name |
claude --permission-mode plan | Start in a specific permission mode |
claude --version | Show the installed version |
claude update | Install the newest version now |
claude doctor | Check your install and settings without starting a session |
claude auth status | Show which account you are signed in with (add --text for plain text) |
claude mcp list | List 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.

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:

| Command | What it does | Reach for it when |
|---|---|---|
/help | Show help and available commands | You 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 space | A long task is filling the context |
/context | Show what is filling the context window, as a colored grid | Claude seems to forget earlier details |
/resume | Reopen an earlier conversation (also /continue) | You want yesterday's session back |
/rename [name] | Name the current session | You want to find it again later |
/branch | Split off a copy of the conversation to try another direction | You want to experiment without losing the current path |
/rewind | Roll 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 conversation | You need a quick check mid-task |
/copy | Copy the last response to the clipboard | You want to paste an answer elsewhere |
/export [file] | Save the conversation as plain text | You want a record |
/recap | Get a one-line summary of the session so far | You come back after a break |
/exit | Leave 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.
Esc
Stop Claude mid-step; the work done so far stays
Type the fix
Say what to change and Claude carries on from there
Esc twice
Open the rewind menu and restore code from before the mistake
/clear
Start over with an empty context if the thread is a mess
Which commands change the model, effort and permissions?
| Command | What 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) |
/fast | Toggle 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 |
/permissions | View and edit your allow, ask and deny rules |
/config | Open 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?
| Command | What it does |
|---|---|
/init | Generate a starter CLAUDE.md file for the project |
/memory | Open and edit your CLAUDE.md files, and switch auto memory on or off |
/mcp | Manage connected MCP servers and their sign-ins |
/skills | List the skills available in this session |
/plugin | Browse, 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 |
/keybindings | Open your keyboard shortcuts file |
/terminal-setup | Add 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 |
/doctor | Run 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:
---
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?
| Command | What it does |
|---|---|
/diff | Review the changes in your working folder, including Claude's edits |
/code-review | Review the current changes for bugs (also /review); add --fix to apply the findings |
/security-review | Check the changes on your branch for security problems |
/usage | See session cost, plan usage limits and activity (also /cost, /stats) |
/status | See version, model, account and which settings files loaded |
/insights | Get an HTML report on how you use Claude Code |
Which commands handle sign-in, other devices and schedules?
| Command | What it does |
|---|---|
/login and /logout | Sign in or out of your Anthropic account |
/powerup | Take short interactive lessons on Claude Code features |
/desktop | Continue this session in the desktop app |
/remote-control | Continue this session from your phone or a browser (also /rc) |
/loop [interval] [prompt] | Repeat a prompt on an interval while the session stays open |
/schedule | Create 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:
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.
| Shortcut | What it does |
|---|---|
| Esc | Stop Claude mid-step (it keeps the work done so far); close a dialog |
| Esc twice | With an empty prompt, open the rewind menu; with text, clear the draft |
| Shift+Tab | Cycle permission modes |
| Ctrl+C | Interrupt; with nothing running, first press clears the prompt, second press exits |
| Ctrl+D | Press twice on an empty prompt to exit |
| Up and Down arrows | Browse your earlier prompts |
| Ctrl+R | Search your prompt history |
| Tab | Accept an autocomplete suggestion |
| Ctrl+O | Show the full transcript, with every tool call |
| Ctrl+T | Show or hide Claude's task checklist |
| Ctrl+B | Move a running command to the background |
| Ctrl+G | Open your prompt, or a proposed plan, in your text editor |
| Ctrl+S | Stash 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+P | Switch model without losing your draft |
| Option+T (Mac) or Alt+T | Toggle extended thinking, on models where it can be switched off |
| Option+O (Mac) or Alt+O | Toggle fast mode |
| ? on an empty prompt | Show 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:
| Mac | Windows | What it does |
|---|---|---|
| Cmd+Esc | Ctrl+Esc | Jump between your file and Claude's prompt box |
| Cmd+Shift+Esc | Ctrl+Shift+Esc | Open a new conversation in an editor tab |
| Option+K | Alt+K | Insert an @-mention of the file and lines you have selected |
| Ctrl+Option+F | Ctrl+Alt+F | Hide 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 this | What happens |
|---|---|
/ at the start | Run a command or skill |
! at the start | Run 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):
| Terminal | Shift+Enter for a new line |
|---|---|
| iTerm2, Ghostty, Kitty, WezTerm, Warp, Windows Terminal 1.25 or later | Works with no setup |
| Alacritty 0.16 or later, foot and other terminals with the kitty keyboard protocol | Works with no setup on Claude Code 2.1.269 or later |
| VS Code, Cursor, Zed, Alacritty before 0.16 | Run /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 IDEs | Not 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:

| The status line shows | Mode | Runs without asking |
|---|---|---|
⏸ manual mode on | Manual (config value default) | Reads only |
⏵⏵ accept edits on | acceptEdits | Reads, file edits and common file commands such as mkdir and mv |
⏸ plan mode on | plan | Reading and exploring; no edits until you approve a plan |
⏵⏵ auto mode on | auto | Most 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.
| File | Applies to | What it holds |
|---|---|---|
~/.claude/settings.json | You, in every project | Personal settings: theme, default model, your own permission rules |
.claude/settings.json | Everyone in the project | Shared permissions, hooks and plugins; commit it to share it |
.claude/settings.local.json | You, in this project | Personal overrides; "Yes, and don't ask again" approvals are saved here |
~/.claude.json | You | Sign-in state, your MCP servers, folder trust; Claude Code maintains it for you |
~/.claude/CLAUDE.md | You, in every project | Personal instructions |
CLAUDE.md or .claude/CLAUDE.md | The project | Project instructions |
CLAUDE.local.md | You, in this project | Private project notes; add it to .gitignore |
.claude/rules/*.md | The project | Instructions split by topic, optionally only for certain files |
.claude/skills/<name>/SKILL.md | The project (or ~/.claude/skills/ for you) | Skills you run with /name |
.mcp.json | The project | MCP servers shared with the team |
~/.claude/keybindings.json | You | Custom keyboard shortcuts |
~/.claude/projects/<project>/memory/ | You, per project | Auto 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:
{
"$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 command | What happened | Use this now |
|---|---|---|
/vim | Removed in version 2.1.92 | Editor mode in /config |
/pr-comments | Removed in version 2.1.91 | Ask Claude to read the pull request comments |
/ultraplan | Removed | Plan mode: /plan or Shift+Tab |
/agents | No longer opens a menu, only a reminder | Ask Claude to create a subagent, or edit .claude/agents/ |
/routines | Renamed, still works as an alias | /schedule |
/extra-usage | Renamed | /usage-credits |
/review as a separate pull request review | An alias of /code-review since version 2.1.223 | /code-review, or /code-review 1234 for pull request 1234 |
claude --enable-auto-mode | Removed in version 2.1.111 | claude --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:

These messages come from Anthropic's error reference and settings docs.
| What you see | What it means | Fix |
|---|---|---|
Unknown command: /hepl. Did you mean /help? | A typo, or a command from a plugin or MCP server that isn't connected | Type / and pick from the filtered menu; check /plugin or /mcp |
Context limit reached · /compact or /clear to continue | The conversation filled the context window | /compact to keep going on the same task, /clear for a new one |
| A Settings Error dialog at startup | A settings file has invalid JSON, such as a trailing comma | Let 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 skipped | A permission rule is malformed | Write it as Tool or Tool(content), ending at the closing parenthesis |
| You edited CLAUDE.md and Claude ignores the change | CLAUDE.md loads at the start of each conversation | Run /clear, then /context to check it is listed under Memory files |
| Claude Code misbehaves after you added a plugin, hook or skill | One customization is broken | Start 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?
Not quite.
/clear empties the context. /compact keeps the same conversation and summarizes it.
Where do your personal settings for every project live?
Not quite.
The file in your home folder applies everywhere. The .claude folder inside a project only applies there.
Your team's .claude/settings.json allows a command and your user settings deny it. What happens?
Not quite.
Permission rules are combined across files, and a deny rule anywhere beats an allow rule anywhere.
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.
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
Claude Code Tutorial: How to Use Claude Code in 9 Steps
Learn how to use Claude Code step by step on a real project: build a one-page business site with plan mode, permissions and rewind, plus 10 beginner tips.
Claude Code · 16 min readCLAUDE.md File: Best Practices, Examples and 3 Templates
What is a CLAUDE.md file? Its role in Claude Code memory, where it goes on Mac and Windows, best practices, 3 copy-ready templates and fixes when it fails.
Claude Code · 16 min readClaude Code Usage Limits 2026: The 5-Hour and Weekly Caps
Claude Code usage limits: how the 5-hour and weekly caps work on Pro, Max, Ultra and Team, when they reset, how to check usage and 8 ways to save tokens.
Claude Code · 17 min read