claude | Start interactive session | claude |
claude "query" | Start interactive session with initial prompt | claude "explain this project" |
claude -p "query" | Query via SDK, then exit | claude -p "explain this function" |
cat file | claude -p "query" | Process piped content | cat logs.txt | claude -p "explain" |
claude -c | Continue most recent conversation in current directory | claude -c |
claude -c -p "query" | Continue via SDK | claude -c -p "Check for type errors" |
claude -r "<session>" "query" | Resume session by ID or name | claude -r "auth-refactor" "Finish this PR" |
claude update | Update to latest version | claude update |
claude gateway | 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. Available in Claude Code v2.1.195 and later. | claude gateway --config gateway.yaml |
claude install [version] | 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 |
claude auth login | 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 |
claude auth logout | Log out from your Anthropic account | claude auth logout |
claude auth status | Show authentication status as JSON. Use --text for human-readable output. Exits with code 0 if logged in, 1 if not | claude auth status |
claude agents | 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 |
claude attach <id> | Attach to a background session in this terminal | claude attach 7c5dcf5d |
claude auto-mode defaults | 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' |
claude auto-mode reset | 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 |
claude daemon status | Print the background-session supervisor’s state, version, socket directory, and worker count for diagnostics. Exits 1 if the supervisor isn’t running | claude daemon status |
claude daemon stop --any | Stop the background-session supervisor and the sessions it hosts. Pass --keep-workers to leave background sessions running so the next supervisor reconnects to them. --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 |
claude doctor | 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 | claude doctor |
claude import [codex|gemini] | 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 |
claude logs <id> | Print recent output from a background session | claude logs 7c5dcf5d |
claude mcp | Configure Model Context Protocol (MCP) servers | See the Claude Code MCP documentation. |
claude mcp login <name> | 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, then paste the redirect URL back at the prompt. Requires Claude Code v2.1.186 or later. See Authenticate from the command line | claude mcp login sentry |
claude mcp logout <name> | Clear stored OAuth credentials for an MCP server. Requires Claude Code v2.1.186 or later | claude mcp logout sentry |
claude plugin | Manage Claude Code plugins. Alias: claude plugins. See plugin reference for subcommands | claude plugin install code-review@claude-plugins-official |
claude project purge [path] | 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 project purge ~/work/repo --dry-run |
claude remote-control | 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" |
claude respawn <id> | 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 |
claude rm <id> | Remove a background session from the list. The conversation transcript stays on your local machine, available through claude --resume | claude rm 7c5dcf5d |
claude self-hosted-runner | 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 |
claude setup-token | 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 | claude setup-token |
claude stop <id> | Stop a background session. Also accepts claude kill | claude stop 7c5dcf5d |
claude ultrareview [target] | 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 30-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. Requires Claude Code v2.1.227 or later. See Post findings to the pull request | claude ultrareview 1234 --json |