Reference· Updated 2026-11-03

Claude Code CLI Reference: Commands & Flags

Every claude command (36) and flag (85), with examples. Filter by commands, flags or system prompt flags, or search for what you want to do.
121 of 121 items
claude
Commands
Start interactive session
Start interactive session with initial prompt
claude "explain this project"
Query via SDK, then exit
claude -p "explain this function"
Process piped content
cat logs.txt | claude -p "explain"
claude -c
Commands
Continue most recent conversation in current directory
Continue via SDK
claude -c -p "Check for type errors"
Resume session by ID or name
claude -r "auth-refactor" "Finish this PR"
Update to latest version
Start the self-hosted Claude apps gateway server, for administrators deploying SSO and policy in front of Claude Code on Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry. Requires --config pointing at a gateway.yaml.
claude gateway --config gateway.yaml
Install or reinstall the native binary. Accepts a version like 2.1.118, or stable or latest. See Install a specific version
claude install stable
Sign in to your Anthropic account. Use --email to pre-fill your email address, --sso to force SSO authentication, and --console to sign in with Anthropic Console for API usage billing instead of a Claude subscription
claude auth login --console
Log out from your Anthropic account
Show authentication status as JSON. Use --text for human-readable output. Exits with code 0 if logged in, 1 if not. The JSON includes a configDirectory field naming the configuration directory the CLI uses. The field requires Claude Code v2.1.268 or later. The JSON's authMethod field is one of none, claude.ai, oauth_token, api_key, api_key_helper, or third_party
Open agent view to monitor and dispatch parallel background sessions. Use --cwd <path> to show only sessions started under that directory, or --json to print active sessions as a JSON array for scripting (--json --all also includes completed background sessions). Pass --permission-mode, --model, --effort, or --agent to set defaults for dispatched sessions. Accepts --settings, --add-dir, --plugin-dir, and --mcp-config like the top-level claude command. Opening agent view requires an interactive terminal
claude agents --json
Attach to a background session in this terminal. Passing part of a running session's name in place of the ID requires Claude Code v2.1.290 or later
claude attach 7c5dcf5d
Print the built-in auto mode classifier rules as JSON. Use claude auto-mode config to see your effective config with settings applied. --label <prefix> prints only the rules whose label starts with that prefix, matched case-insensitively. Requires Claude Code v2.1.208 or later
claude auto-mode defaults --label 'Git Destructive'
Restore the default auto mode configuration by removing the autoMode section from your user settings file. Prompts for confirmation before writing; pass -y/--yes to skip the prompt. Rules from managed settings or the --settings flag still apply. Requires Claude Code v2.1.212 or later. See Inspect the defaults and your effective config
claude auto-mode reset --yes
Follow the background-session supervisor's log file, ~/.claude/daemon.log, printing new lines as they arrive until you press Ctrl+C
Run the background-session supervisor in the foreground of this terminal, printing its log
Print the background-session supervisor's state, version, socket directory, and worker count for diagnostics. Exits 1 if the supervisor isn't running
Stop the background-session supervisor and the sessions it hosts. Pass --keep-workers to leave background sessions running for the next supervisor to reconnect to. --any confirms stopping an on-demand supervisor, which is the default. Use this to recover from an unresponsive supervisor
claude daemon stop --any --keep-workers
Print read-only installation and settings diagnostics from the terminal without starting a session, including install health, settings-file validation errors, and Remote Control eligibility. For the in-session setup checkup that can also apply fixes, run /doctor
Start an interactive session that runs /import to bring configuration from other coding agents into Claude Code. Accepts the same --dry-run and --yes options as the command. Not available on Amazon Bedrock, Google Cloud's Agent Platform, Microsoft Foundry, or Claude Platform on AWS. Also unavailable when you turn off feature-flag fetching. Requires Claude Code v2.1.213 or later
claude import codex --dry-run
Print recent output from a background session. Passing part of a session's name in place of the ID requires Claude Code v2.1.290 or later
claude logs 7c5dcf5d
claude mcp
Commands
Configure Model Context Protocol (MCP) servers
See the [Claude Code MCP documentation](https://code.claude.com/docs/en/mcp).
Run a configured MCP server's OAuth flow without opening the interactive /mcp panel. Works for HTTP, SSE, and claude.ai connector servers. Add --no-browser over SSH to print the authorization URL instead of opening a browser. For an HTTP or SSE server, paste the redirect URL back at the prompt. For a claude.ai connector, see Authorize a connector again from your shell. See Authenticate from the command line
claude mcp login sentry
Clear stored OAuth credentials for an MCP server
claude mcp logout sentry
Manage Claude Code plugins. Alias: claude plugins. See plugin reference for subcommands
claude plugin install code-review@claude-plugins-official
Delete all local Claude Code state for a project: transcripts, task lists, debug logs, file-edit history, prompt history lines, and the project's entry in ~/.claude.json. Omit [path] to pick from an interactive list. Flags: --dry-run to preview, -y/--yes to skip confirmation, -i/--interactive to confirm each item, --all for every project. See Clear local data
claude purge ~/work/repo --dry-run
Start a Remote Control server to control Claude Code from Claude.ai or the Claude app. Runs in server mode (no local interactive session). See Server mode flags. After you stop the server, you can bring back the sessions it was serving. See Resume sessions after stopping the server
claude remote-control --name "My Project"
Restart a background session, running or stopped, with its conversation intact. Use --all to restart every running session, e.g. to pick up an updated Claude Code binary
claude respawn 7c5dcf5d
Remove a background session from the list. When the removal is refused over the session's worktree and a second claude rm can resolve it, the refusal prints the exact flag and value to pass: --discard-unpushed <commit>@<worktree-id> discards a worktree that has unpushed commits along with those commits, and --force-remove-worktree <worktree-id> deletes a worktree directory that git or the WorktreeRemove hook couldn't remove. --discard-unpushed requires Claude Code v2.1.260 or later, and --force-remove-worktree requires v2.1.268 or later. The conversation transcript stays on your local machine, available through claude --resume
claude rm 7c5dcf5d
Start a runner process that registers this machine or container with a self-hosted environment and hosts Claude Code cloud sessions on your infrastructure. Run claude self-hosted-runner setup for a guided operator walkthrough, claude self-hosted-runner doctor to diagnose a deployed runner, and claude self-hosted-runner orchestrator to spawn on-demand runners. Requires Claude Code v2.1.224 or later
claude self-hosted-runner setup
Generate a long-lived OAuth token for CI and scripts. Prints the token to the terminal without saving it. Requires a Claude subscription. See Generate a long-lived token
Stop a background session. Also accepts claude kill
claude stop 7c5dcf5d
Run ultrareview non-interactively. Prints findings to stdout and exits 0 on success or 1 on failure. Use --json for the raw payload and --timeout <minutes> to override the 45-minute default. Use --post on a github.com pull request target to post the finished findings to the PR as one plain comment from your GitHub account. --no-post is the default. --post and --no-post require Claude Code v2.1.227 or later. See Post findings to the pull request
claude ultrareview 1234 --json
Add additional working directories for Claude to read and edit files. Grants file access; Claude Code doesn't discover most .claude/ configuration from these directories. Validates that each path exists as a directory. You can't add most network paths, such as \\server\share. To persist these directories across sessions, set permissions.additionalDirectories in settings
claude --add-dir ../apps ../lib
Enable the server-side advisor tool for this session with a model alias, fable, opus, or sonnet, or a full model ID. Takes precedence over the advisorModel setting for the session. fable requires Fable access
claude --advisor opus
--agent
Flags
Specify an agent for the current session (overrides the agent setting)
claude --agent my-custom-agent
Define custom subagents dynamically via JSON. Accepts the fields listed for CLI-defined subagents. With --print, the value can instead be the path to a JSON file holding the object; the file form requires Claude Code v2.1.281 or later. Claude Code validates the value at startup and exits on an invalid one; see Invalid --agents configuration for the message and for the flags and environment variable that skip the validation. Validation requires Claude Code v2.1.242 or later
claude --agents '{"reviewer":{"description":"Reviews code","prompt":"You are a code reviewer"}}'
Add bypassPermissions to the Shift+Tab mode cycle without starting in it. Lets you begin in a different mode like plan and switch to bypassPermissions later. See permission modes
claude --permission-mode plan --allow-dangerously-skip-permissions
Tools that execute without prompting for permission, apart from reads from network paths. See permission rule syntax for pattern matching. To restrict which tools are available, use --tools instead. If you name one of the task-tracking tools here, Claude Code also opts the session in
"Bash(git log *)" "Bash(git diff *)" "Read"
Append custom text to the end of every subagent's system prompt, nested subagents included, apart from a forked subagent, which reuses the conversation's own prompt. Only applies in non-interactive mode with -p. Requires Claude Code v2.1.205 or later
claude -p --append-subagent-system-prompt "Cite file paths in every answer" "query"
Load text from a file and append it to subagent system prompts. An alternative to --append-subagent-system-prompt for text too long to pass on the command line. The two flags can't be combined. Only applies in non-interactive mode with -p. Requires Claude Code v2.1.261 or later
claude -p --append-subagent-system-prompt-file ./subagent-rules.txt "query"
Append custom text to the end of the default system prompt
claude --append-system-prompt "Always use TypeScript"
Load additional system prompt text from a file and append to the default prompt
claude --append-system-prompt-file ./extra-rules.txt
Set the auto-compact window for this session without changing your saved settings. Accepts the same values as /autocompact; that section covers the value forms and what overrides the flag. Requires Claude Code v2.1.221 or later
claude --autocompact 500k
Render screen-reader friendly output: flat text without decorative borders or animations. Forces the classic renderer, so the tui setting has no effect; attached background sessions still render fullscreen. Takes precedence over CLAUDE_AX_SCREEN_READER and the axScreenReader setting. Requires Claude Code v2.1.181 or later
claude --ax-screen-reader
--bare
Flags
Minimal mode: skip auto-discovery of hooks, skills, custom commands, subagents, installed plugins, MCP servers, auto memory, and CLAUDE.md so scripted calls start faster. Skills in a directory you pass with --add-dir still load. Claude has access to Bash, file read, and file edit tools. Sets CLAUDE_CODE_SIMPLE. See bare mode
claude --bare -p "query"
--betas
Flags
Beta headers to include in API requests (API key users only)
claude --betas interleaved-thinking
Start the session as a background agent and return immediately. Prints the session ID and management commands. Combine with --exec to run a shell command as a background job instead of a Claude session, or with --agent to run a specific subagent. Checks workspace trust for the directory before it starts. Can't be combined with -p/--print; see the error reference
claude --bg "investigate the flaky test"
(Research preview) MCP servers whose channel notifications Claude should listen for in this session. Space-separated list of plugin:<name>@<marketplace> entries. Requires Anthropic authentication through claude.ai or a Console API key
claude --channels plugin:my-notifier@my-marketplace
Enable Chrome browser integration for web automation and testing
claude --chrome
--cloud
Flags
With a task description, create a new cloud session. With a session ID (session_... or cse_...) or a claude.ai/code URL, queue a message into that existing session instead, with -p. See send a follow-up message.
claude --cloud "Fix the login bug"
Load the most recent conversation in the current directory, including a background session that has finished; opening finished background sessions requires Claude Code v2.1.257 or later. Skips sessions created with claude -p or the Agent SDK, and sessions whose first prompt was /loop. claude -p --continue includes -p, SDK, and /loop sessions. Includes sessions that added this directory with /add-dir
claude --continue
Enable channels that are not on the approved allowlist, for local development. Accepts plugin:<name>@<marketplace> and server:<name> entries. Prompts for confirmation, so it takes effect in interactive sessions. With -p, Claude Code ignores the flag
claude --dangerously-load-development-channels server:webhook
Skip permission prompts. Equivalent to --permission-mode bypassPermissions. See permission modes for what this does and does not skip. For sessions started with --bg, the mode persists when the supervisor restarts the session
claude --dangerously-skip-permissions
--debug
Flags
Enable debug mode with optional category filtering, such as --debug='mcp,startup' or --debug='!mcp'. The filter binds only in the = form; a space-separated filter enables debug mode without filtering
claude --debug='mcp,startup'
Write debug logs to a specific file path. Implicitly enables debug mode. Takes precedence over CLAUDE_CODE_DEBUG_LOGS_DIR
claude --debug-file /tmp/claude-debug.log
Open the Claude Desktop app on the current directory and exit without starting a session in the terminal. Add --continue, or --resume with a session ID, to open that session in Desktop instead. --resume here takes only a session ID, not a name or transcript path. Takes no prompt and no other flags except --verbose and the --debug flags, since the app starts the session itself. Available on macOS and x64 Windows when you're signed in with a Claude subscription. Requires Claude Code v2.1.285 or later
claude --desktop
Disable all skills and commands for this session
claude --disable-slash-commands
Deny rules. A bare tool name removes the matching tools from Claude's context: "Edit" removes Edit, "*" removes every tool, and "mcp__*" removes every MCP tool. A scoped rule such as Bash(rm *) leaves the tool available and denies only calls that match as written. A rule naming EndConversation can't remove it while any other tool remains
"Bash(git log *)" "Bash(git diff *)" "Edit"
Set the effort level for the current session. Options: low, medium, high, xhigh, max, or ultracode. Available levels depend on the model. ultracode requests xhigh effort with ultracode turned on, and requires Claude Code v2.1.203 or later. On the main conversation's model, overrides the modelSettings and effortLevel settings for this session and doesn't persist
claude --effort high
Removed in v2.1.111. Auto mode is now in the Shift+Tab cycle by default; use --permission-mode auto to start in it
claude --permission-mode auto
Create a new cloud session that runs on the self-hosted environment with the given ID. Environment IDs start with ccpool_. See --environment dispatch behavior for dispatch behavior and the flag combinations it rejects. Requires Claude Code v2.1.224 or later
claude -p "Fix the login bug" --environment ccpool_abc123
Move per-user context, such as the auto memory location, out of the system prompt and into the first user message. Improves prompt-cache reuse across different users and machines running the same task. Only applies with the default system prompt; ignored when --system-prompt or --system-prompt-file is set. Use with -p for scripted, multi-user workloads
claude -p --exclude-dynamic-system-prompt-sections "query"
--exec
Flags
Run a shell command as a PTY-backed background job instead of starting a Claude session. Use with --bg to launch from the shell
claude --bg --exec 'pytest -x'
Enable automatic fallback to the specified model(s) when the primary model is overloaded or not available, for example a retired model. Accepts a comma-separated list tried in order. See Fallback model chains. To persist a chain across sessions, use the fallbackModel setting, which this flag overrides
claude --fallback-model sonnet,haiku
When resuming, create a new session ID instead of reusing the original (use with --resume or --continue)
claude --resume abc123 --fork-session
Emit subagent text and thinking blocks in the output stream as assistant and user messages with parent_tool_use_id set, so you can reconstruct each subagent's transcript. Without this flag, Claude Code omits the text and thinking blocks of a subagent that runs in the foreground. Requires --print and --output-format stream-json. For nested subagents, forked skills, and the version each needs, see Follow subagent messages. The CLAUDE_CODE_FORWARD_SUBAGENT_TEXT environment variable enables the same behavior. Requires Claude Code v2.1.211 or later
claude -p --output-format stream-json --verbose --forward-subagent-text "query"
Open the session picker filtered to sessions linked to a specific pull request. Accepts a PR number, a GitHub or GitHub Enterprise PR URL, a GitLab merge request URL, or a Bitbucket pull request URL. Sessions are linked automatically when Claude creates the pull request
claude --from-pr 123
--ide
Flags
Automatically connect to IDE on startup if exactly one valid IDE is available
claude --ide
--init
Flags
Run Setup hooks with the init matcher before the session (print mode only)
claude -p --init "query"
Run Setup and SessionStart hooks, then exit without starting a conversation
claude --init-only
Include hook lifecycle events in the output stream. SessionStart and Setup hook events are always included and don't need this flag. Some hook events, such as Notification, SessionEnd, PreCompact, and PostCompact, never produce a hook_started event, even with this flag. For those events, Claude Code still emits hook_progress while a command hook that runs for more than a second produces output, and emits hook_response only when a hook that runs in the background finishes. Requires --output-format stream-json
claude -p --output-format stream-json --verbose --include-hook-events "query"
Include partial streaming events in output. Requires --print and --output-format stream-json
claude -p --output-format stream-json --verbose --include-partial-messages "query"
Specify input format for print mode (options: text, stream-json)
claude -p --input-format stream-json --output-format stream-json --verbose
Get validated JSON output matching a JSON Schema after the agent completes its workflow (print mode only). See structured outputs. Claude Code exits with an error on an invalid schema and accepts the format keyword as an annotation without client-side validation
claude -p --json-schema '{"type":"object","properties":{...}}' "query"
Run Setup hooks with the maintenance matcher before the session (print mode only)
claude -p --maintenance "query"
Stop the run once estimated spend on API calls reaches this amount (print mode only). Claude Code checks the cap against its client-side cost estimate, which can differ from your bill. Spend from subagents counts toward the cap. Spend can pass the cap, so leave headroom. When you return to a conversation with --continue or --resume, totals restored from earlier runs don't count toward it. Once spend reaches the cap, spawning another subagent fails with Budget limit reached, and Claude Code stops background subagents that are still running; the cap-enforcement behaviors require Claude Code v2.1.217 or later
claude -p --max-budget-usd 5.00 "query"
Limit the number of agentic turns (print mode only). No limit by default. With --input-format stream-json, a message still queued when the limit ends a turn stays queued and starts a new turn with its own limit
claude -p --max-turns 3 "query"
Load MCP servers from JSON files or strings (space-separated). When you pass this flag with -p, Claude Code waits for still-pending servers to connect before running the first turn, up to the MCP_TIMEOUT startup timeout, 30 seconds by default; a server with a cached tool list skips the wait and connects on first use. In a self-hosted environment, a shorter wait applies instead. The wait requires Claude Code v2.1.221 or later
claude --mcp-config ./mcp.json
--model
Flags
Sets the model for the current session with a model alias such as sonnet, opus, haiku, or fable, or a model's full name. Overrides the model setting and ANTHROPIC_MODEL
claude --model claude-sonnet-5
Set a display name for the session, shown in /resume and the terminal title. You can resume a named session with claude --resume <name>. /rename changes the name mid-session and also shows it on the prompt bar
claude -n "my-feature-work"
Disable Chrome browser integration for this session
claude --no-chrome
Disable session persistence so sessions are not saved to disk and cannot be resumed. Print mode only. The CLAUDE_CODE_SKIP_PROMPT_HISTORY environment variable does the same in any mode
claude -p --no-session-persistence "query"
Specify output format for print mode (options: text, json, stream-json)
claude -p "query" --output-format json
Begin in a specified permission mode. Accepts default, acceptEdits, plan, auto, dontAsk, bypassPermissions, or manual as an alias for default. The manual alias selects the permission mode the UI labels Manual and requires Claude Code v2.1.200 or later; claude --help lists it in place of default, and both values work. Overrides defaultMode from settings files. Without this flag or --dangerously-skip-permissions, a new session starts in the permission mode described in which permission mode a session starts in, which also covers what a -p run starts in
claude --permission-mode plan
Specify an MCP tool to handle permission prompts in non-interactive mode. Pass the full name, such as mcp__<server>__<tool>, of a tool on an MCP server that the run loads. Claude Code waits for that tool's MCP server to connect before running the first turn, up to the MCP_TIMEOUT startup timeout, 30 seconds by default. The prompt tool can't approve an MCP tool marked as requiring user interaction: Claude Code converts an allow result for one to a deny. This restriction requires Claude Code v2.1.199 or later
claude -p --mcp-config ./mcp.json --permission-prompt-tool mcp__permissions__approve "query"
Set who answers permission prompts in print mode. With the default host, Claude Code sends them to the Agent SDK host or the --permission-prompt-tool tool. Pass none when nobody can answer, and Claude Code denies them instead. See Turn off permission prompts in unattended runs. Requires Claude Code v2.1.259 or later
claude -p --permission-prompts none "query"
Load a plugin from a directory or .zip archive, or several from a folder of plugins, for this session only. Each flag takes one path. Repeat the flag for more paths: --plugin-dir A --plugin-dir B.zip. Passing a folder of plugins requires Claude Code v2.1.265 or later
claude --plugin-dir ./my-plugin
Fetch a plugin .zip archive from a URL for this session only. Repeat the flag for multiple plugins, or pass space-separated URLs in a single quoted value
claude --plugin-url https://example.com/plugin.zip
Emit a prompt_suggestion message with a predicted next user prompt after each turn that generates one; very short conversations can produce none. Requires --print, --output-format stream-json, and --verbose. See Prompt suggestions
claude -p --prompt-suggestions --output-format stream-json --verbose "query"
With --environment, base the new session's checkout on a named ref instead of local HEAD
claude -p "Run the smoke test" --environment ccpool_abc123 --ref main
Deprecated alias for --cloud, including the existing-session form
claude --remote "Fix the login bug"
Start an interactive session with Remote Control enabled so you can also control it from claude.ai or the Claude app. Optionally pass a name for the session
claude --remote-control "My Project"
Prefix for auto-generated Remote Control session names when no explicit name is set. Defaults to your machine's hostname, producing names like myhost-graceful-unicorn. Set CLAUDE_REMOTE_CONTROL_SESSION_NAME_PREFIX for the same effect
claude remote-control --remote-control-session-name-prefix dev-box
Re-emit user messages from stdin back on stdout for acknowledgment. Requires --input-format stream-json and --output-format stream-json
claude -p --input-format stream-json --output-format stream-json --verbose --replay-user-messages
Start in restricted mode. Use it when an evaluation harness drives claude on a shared machine and Claude Code must not run commands or read that machine's user and project settings. Claude Code removes the built-in tools that run commands or code, and WebFetch, unless you name them individually in --tools, not through the default preset. It also confines the built-in file tools to the working directories, loads only managed settings and --settings, refuses bypassPermissions, and refuses to create cloud sessions. Requires Claude Code v2.1.248 or later
claude --restricted -p "query"
Resume a specific session by ID or name, or show an interactive picker to choose a session. In place of an ID, you can pass the absolute path to a session's .jsonl transcript file. The picker and name search include sessions that added this directory with /add-dir. When you pass a session ID, Claude Code searches the current project directory and its git worktrees, then every other project on this machine. Before v2.1.223, the ID search covered only the current project directory and its git worktrees. Background sessions appear in the picker marked with bg. Resuming one that is still running opens that session in this terminal through claude attach, and a prompt you pass on the command line goes to it as its next turn. Before v2.1.285, Claude Code refused and printed the claude attach command to run instead
claude --resume auth-refactor
Start with all customizations disabled to troubleshoot a broken configuration: CLAUDE.md, skills, plugins, hooks, MCP servers, custom commands and agents, output styles, workflows, custom themes, custom keybindings, status line and file-suggestion commands, LSP servers, and auto memory do not load. Authentication, model selection, built-in tools, and permissions work normally, which differs from --bare. Managed settings policy still applies, including policy-configured hooks, status line, and file-suggestion commands; managed plugins, managed skills, managed CLAUDE.md, and policy-configured MCP servers do not. Useful for checking whether a customization is what triggers automatic model fallback. Sets CLAUDE_CODE_SAFE_MODE
claude --safe-mode
Use a specific session ID for the conversation (must be a valid UUID)
claude --session-id "550e8400-e29b-41d4-a716-446655440000"
Comma-separated list of setting sources to load (user, project, local). See agent view and agent teams for the sessions you start from this one that inherit the list
claude --setting-sources user,project
Path to a settings JSON file or an inline JSON string. Values you set here override the same keys in your settings.json files for this session. Keys you omit keep their file-based values. The file must be a regular file no larger than 2 MiB. See settings precedence
claude --settings ./settings.json
Only use MCP servers from --mcp-config, ignoring all other MCP configurations. See Exclusive control with managed-mcp.json for what the flag does under a managed MCP file
claude --strict-mcp-config --mcp-config ./mcp.json
Replace the entire system prompt with custom text
claude --system-prompt "You are a Python expert"
Load system prompt from a file, replacing the default prompt
claude --system-prompt-file ./custom-prompt.txt
Pass off to rebuild the system prompt on every request instead of reusing the prompt recorded on the conversation's first request, for example while you iterate on --append-system-prompt text across --continue runs. Requires Claude Code v2.1.257 or later
claude --system-prompt-snapshot off
Resume a cloud session in your local terminal
claude --teleport
Set how agent team teammates display: in-process (default), auto, tmux, or iterm2. Overrides the teammateMode setting for this session. See Choose a display mode
claude --teammate-mode auto
--tmux
Flags
Create a tmux session for the worktree. Requires --worktree. Uses iTerm2 native panes when available; pass --tmux=classic for traditional tmux
claude -w feature-auth --tmux
--tools
Flags
Restrict which built-in tools Claude can use. Use "" to disable all, "default" for the default set, or tool names like "Bash,Edit,Read". On macOS, Linux, and WSL, the default set leaves out Glob and Grep, as described under Glob tool behavior. If you name one of the task-tracking tools here, Claude Code also opts the session in. The flag doesn't affect MCP tools; to deny those too, use --disallowedTools "mcp__*". A list that omits EndConversation doesn't remove it; "" removes it only when no MCP tools remain
claude --tools "Bash,Edit,Read"
Enable verbose logging, shows full turn-by-turn output. Overrides the viewMode setting for this session
claude --verbose
Output the version number
claude -v
Start Claude in an isolated git worktree at <repo>/.claude/worktrees/<name>. If you don't give a name, Claude Code generates one. Pass #<number>, a GitHub pull request URL, or a GitLab merge request URL to fetch that PR or MR from origin and branch the worktree from it. Branching from a GitLab merge request requires Claude Code v2.1.233 or later
claude -w feature-auth
--system-prompt
System prompt flags
Replaces the entire default prompt
claude --system-prompt "You are a Python expert"
--system-prompt-file
System prompt flags
Replaces with file contents
claude --system-prompt-file ./prompts/review.txt
--append-system-prompt
System prompt flags
Appends to the default prompt
claude --append-system-prompt "Always use TypeScript"
--append-system-prompt-file
System prompt flags
Appends file contents to the default prompt
claude --append-system-prompt-file ./style-rules.txt
--system-prompt-snapshot
System prompt flags
With off, rebuilds the prompt on every request. With on, the default, reuses a recorded prompt where recording applies
claude --append-system-prompt "Draft rules" --system-prompt-snapshot off

Most-used flags

  • -p / --print: run once and print the answer. The basis of every script and CI job.
  • -c / --continue and -r / --resume: pick up where you left off.
  • --model: choose the model for this session.
  • --permission-mode, --allowedTools, --disallowedTools: control what runs without asking. Test rules with the permission rule tester.
  • --append-system-prompt: add instructions without replacing Claude Code's own system prompt.

Frequently asked questions

How do I run Claude Code non-interactively?

Use print mode: claude -p "your prompt". It runs the task, prints the result and exits, which suits scripts and CI. Add --output-format json or stream-json for machine-readable output, and --allowedTools to pre-approve the tools it needs.

How do I resume a previous Claude Code session?

claude -c (or --continue) reopens the most recent conversation in the current directory. claude -r (or --resume) opens a picker, or takes a session ID or name to resume a specific one.

What does --dangerously-skip-permissions do?

It starts Claude Code in bypassPermissions mode, which skips permission prompts except for a few protected actions. Only use it in an isolated container or VM, never on a machine with credentials or data you care about.

How do I pick a model from the command line?

Pass --model with an alias (opus, sonnet, haiku, fable) or a full model ID such as claude-opus-5-5. You can also set ANTHROPIC_MODEL or the model key in settings.json.

Sources: Claude Code CLI reference. Claude Code Agents is an independent site, not affiliated with Anthropic.

More free Claude Code tools

All tools →