1. Symvibe
  2. Guides
  3. Claude Code CLI cheat sheet

Claude Code CLI cheat sheet

The claude CLI has grown past what fits in its own help screen. This page puts the commands you type every day first, then the flags, slash commands, shortcuts and file locations, each checked against Claude Code 2.1.311 and the official reference. Not installed yet? Start with the Mac install guide.

Start, continue and resume

These are the commands you type every day. Each one starts in the folder you are in, and that folder decides which project, memory files and sessions Claude Code sees.

CommandWhat it does
claudeStarts an interactive session.
claude "query"Starts an interactive session with a first prompt.
claude -p "query"Answers once and exits. Print mode, for scripts and CI.
cat file | claude -p "query"Sends piped content along with the prompt.
claude -cContinues the most recent conversation in this folder.
claude -c -p "query"Continues it without opening the interface.
claude -r <name> "query"Resumes a session by ID or name. Without a value, -r opens the session picker.
claude -n <name>Starts a session with a display name, which is what you resume it by later.
claude -r <name> --fork-sessionResumes into a new session ID and leaves the original untouched.
claude -w <name>Starts in a new git worktree at .claude/worktrees/<name>, on branch worktree-<name>.
claude -n checkout-refactor      # name it at start
claude -r checkout-refactor      # resume it tomorrow
claude -w feature-auth           # own checkout, own branch
cat error.log | claude -p "explain this stack trace"
-c or -r?

-c takes the latest conversation in the folder, which is ambiguous once several sessions live there. -r <name> always brings back the one you mean. Name sessions with -n or /rename and resume by name.

Commands outside a session

Subcommands of claude that do a job and return to the shell.

CommandWhat it does
claude updateChecks for an update and installs it. Homebrew and npm installs update through their package manager.
claude install [stable|latest|version]Installs the native build, at a channel or a specific version.
claude doctorChecks the health of the installation. Inside a session, /doctor goes further and proposes fixes.
claude auth login, logout, statusSigns in to your Anthropic account, signs out, or shows how you are signed in.
claude setup-tokenCreates a long-lived token for CI, which needs a Claude subscription.
claude mcp add, list, get, removeConfigures MCP servers. claude mcp serve runs Claude Code itself as an MCP server.
claude plugin install, list, updateManages plugins and plugin marketplaces.
claude agentsLists background agents. claude attach <name> opens one in this terminal and claude logs <name> prints its recent output.
claude import codex|gemini|cursorImports configuration from another coding agent. Add --dry-run to see what it would change.
claude purge [path]Deletes a project's Claude Code data from this computer only.

Flags worth knowing

claude --help says itself that it does not list every flag. These are the ones that change how a session behaves, grouped by what they touch.

Session

FlagEffect
-c, --continueContinue the most recent conversation in this folder.
-r, --resume [id or name]Resume a session, or open the picker.
--fork-sessionWith a resume, create a new session ID instead of reusing the old one.
-n, --nameDisplay name for the session.
-w, --worktree [name]Start in a new git worktree. Passing a PR number or URL branches from that pull request.
--tmuxWith -w, also create a tmux session for the worktree.
--add-dir <dirs>Let the session read and edit directories outside the one it started in.

Model and effort

FlagEffect
--model <model>Model for this session: an alias such as sonnet, opus or haiku, or a full model name.
--effort <level>How much reasoning to apply: low, medium, high, xhigh or max.
--fallback-model <model>Switch to this model automatically when the main one is overloaded.

Permissions and tools

FlagEffect
--permission-mode <mode>Start in a mode: default (also called manual), acceptEdits, plan, auto, dontAsk or bypassPermissions.
--allowedTools, --disallowedToolsAllow or deny tools without a prompt, with patterns such as "Bash(git log *)" or "Edit".
--tools <list>Limit the tools the session has at all, for example "Bash,Edit,Read".
--dangerously-skip-permissionsSame as --permission-mode bypassPermissions: no prompts at all. Keep it for places where a mistake cannot hurt, such as a throwaway container. What it skips and what still asks.

Print mode, for scripts

FlagEffect
-p, --printAnswer and exit instead of opening the interface.
--output-format text|json|stream-jsonShape of the answer. JSON includes the result and session metadata.
--input-format text|stream-jsonShape of what you pipe in.
--max-turns <n>Stop after that many agent turns. There is no limit by default.
--max-budget-usd <amount>Stop when the run has spent that much on API calls.
--json-schema <schema>Ask for structured output that matches a JSON Schema.
--append-system-prompt, --system-promptAdd to the system prompt, or replace it.
--bareA minimal run that skips most of the discovery a normal session does. The docs say it will become the default for -p.

Configuration and debugging

FlagEffect
--settings <file or json>Load extra settings for this session.
--mcp-config <files>Load MCP servers from JSON files. Add --strict-mcp-config to use only those.
--agents <json>Define subagents for this session only.
--plugin-dir <dir>Load a plugin from a folder, for testing it.
--ideConnect to your IDE on startup when exactly one is available.
--verbose, -d, --debug [filter]Full turn-by-turn output, or debug logs such as --debug=mcp.

Slash commands inside a session

Type / at the prompt to see every command available to you; availability varies by plan and platform. The ones below are built in.

CommandWhat it does
/clearStart a new conversation with empty context. Aliases /reset and /new.
/compact [focus]Summarize the conversation so far to free context, optionally around a focus you give.
/contextShow what fills the context window, as a colored grid.
/rewindGo back to an earlier point in the conversation, the code, or both.
/btw [question]Ask a side question without adding it to the conversation.
/resume [session]Return to an earlier conversation, or open the picker.
/rename [name]Rename the session; without a name, one is generated.
/branch [name]Branch the conversation here and try another direction. The original stays in /resume.
/fork [prompt]Copy the conversation into a new background session and keep working here.
/background, /tasksDetach the session to keep running as a background agent; list the background work of this session.
/model [model], /effort [level], /fastSwitch model and save it as the default, set the effort level, toggle fast mode.
/plan [task]Enter plan mode, optionally starting on a task.
/permissionsManage allow, ask and deny rules for tools.
/initWrite a CLAUDE.md for the project. If it finds Codex or Gemini CLI configuration, it offers to carry it over.
/memoryEdit CLAUDE.md files and manage auto memory.
/add-dir <path>Give the session access to another directory.
/mcp, /hooks, /plugin, /skillsManage MCP connections, view hooks, manage plugins, list skills.
/diffReview the changes in your working tree, including Claude's edits.
/code-review, /security-reviewCheck the current diff for bugs (/review is an alias), or the branch for security issues.
/loop [interval] [prompt]Run a prompt repeatedly while the session stays open.
/usageSession cost, plan usage limits and activity stats. /cost and /stats are aliases.
/status, /configVersion, model, account and connectivity; the settings interface.
/login, /logoutSign in to or out of your Anthropic account.
/doctorA setup checkup that diagnoses problems and proposes fixes.
/export [file]Export the conversation as plain text.
/statusline, /terminal-setup, /theme, /keybindingsStatus line, the Shift+Enter newline key, color theme, your shortcuts file.
/exitQuit. Alias /quit.
Changed recently

/vim is gone; editor mode lives in /config. /agents now only reminds you to ask Claude for a subagent or to edit .claude/agents/. The # shortcut for memory is no longer documented: ask Claude to remember something, or use /memory.

Keyboard shortcuts

KeyAction
EscInterrupt Claude and keep the work so far, or close a dialog.
Esc EscWith text typed: clear it (it stays in history). With an empty prompt: open the rewind menu.
Shift+TabCycle permission modes: default, acceptEdits, plan, then bypassPermissions and auto where available.
Ctrl+CInterrupt or clear the input. Press again to exit.
Ctrl+DExit, with a second press.
Ctrl+RSearch your prompt history.
Ctrl+OToggle the transcript viewer.
Ctrl+BSend running shell commands and agents to the background. Inside tmux, press it twice.
Ctrl+TShow or hide Claude's task checklist.
Ctrl+GOpen the prompt in your editor.
Ctrl+VPaste an image.
Option+P, Option+T, Option+OSwitch model, toggle extended thinking, toggle fast mode.
/, !, @, ?At the start of the prompt: a command or skill, a shell command, a file mention, the shortcut help.

New lines in a prompt: a backslash then Return works in every terminal. Shift+Return works natively in iTerm2, Ghostty, WezTerm, Kitty, Warp and Apple Terminal; /terminal-setup adds it to others. Option+Return and Ctrl+J work too.

Files and environment variables

WhereWhat lives there
~/.claude/settings.jsonYour settings for every project.
.claude/settings.jsonProject settings, meant to be committed and shared.
.claude/settings.local.jsonYour project settings that stay out of git.
~/.claude.jsonAccount details, MCP configuration and per-project state.
~/.claude/CLAUDE.mdInstructions for every project.
./CLAUDE.md or ./.claude/CLAUDE.mdProject instructions. Claude Code also reads the ones in parent folders, and CLAUDE.local.md for your private notes.
.claude/rules/Extra rule files, per project or in ~/.claude/rules/.

Precedence runs managed settings, then command-line flags, then local, project and user files. Environment variables can go in your shell or under "env" in a settings file:

VariableMeaning
CLAUDE_CONFIG_DIRUse another configuration folder instead of ~/.claude. This is how two accounts run side by side.
ANTHROPIC_API_KEYBill the API with this key, even when you are signed in with a subscription.
ANTHROPIC_MODELDefault model; --model overrides it.
CLAUDE_CODE_OAUTH_TOKENThe subscription token for CI that claude setup-token creates.
CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEXRun through Amazon Bedrock or Google Cloud instead of Anthropic's API.

When one terminal is not enough

Every claude process is its own session, so the flags above compose: -n to name each one, -w to give each its own checkout, -r to bring them back. How to run multiple Claude Code sessions at once covers tabs, tmux and worktrees in detail.

Symvibe, which we make, is the board for that stage: each console is the real claude from your PATH in a real terminal, so every command on this page works in it unchanged. Consoles relaunch when you reopen the app and offer Claude Code's own resume, and Codex, Gemini CLI and other agents get consoles next to it.

Questions people ask

Where is the complete list of flags?

In the CLI reference of the Claude Code docs. claude --help on version 2.1.311 leaves some out, and says so. This page lists the ones that change how a session behaves.

What is the difference between claude -c and claude -r?

-c continues the most recent conversation in the current folder. -r resumes a specific one by ID or name, or opens a picker without a value. With more than one session per folder, resume by name.

How do I run Claude Code in a script or in CI?

Use print mode: claude -p "query", with --output-format json if a program reads the answer, and --allowedTools or --permission-mode so it never waits for a prompt. For a subscription in CI, claude setup-token creates the token that CLAUDE_CODE_OAUTH_TOKEN carries.

How do I see how much of my plan I have used?

Run /usage inside a session; /cost and /stats open the same screen. What each plan includes is in the Claude Code pricing guide.

How do I change the model?

/model inside a session switches it and saves it as your default. --model sets it for one session, and ANTHROPIC_MODEL sets a default from the environment.

Can I bring over my Codex or Gemini CLI setup?

Yes. claude import codex, gemini or cursor imports their configuration, and /init offers to do it when it finds one. To keep both tools instead, see Codex vs Claude Code.

Every claude session on one board

Symvibe runs the real claude CLI in real terminals on one canvas, with names, resume on reopen and other agents next to it. Your login, your plan, your Mac.

macOS 14 or later · Apple Silicon · USD 19 a month or USD 190 a year