Claude Code — CLI Commands
Terminal commands vs slash commands
claude ...is a shell command — you run it in your terminal, before/outside a session./commandis a slash command — you type it inside an interactive Claude Code session.They overlap on purpose:
claude updateruns in the shell,/upgraderuns in a session;claude mcp addconfigures servers,/mcpmanages them live. This page covers the shell side only. See Claude Code — Slash Commands for the other half. Flags are documented separately in Claude Code — CLI Flags.
Starting and resuming sessions
| Command | What it does |
|---|---|
claude | Start an interactive session |
claude "query" | Start interactive with an initial prompt |
claude -p "query" | Query non-interactively (print mode), then exit |
cat file | claude -p "query" | Process piped content |
claude -c | Continue the most recent conversation in the current directory |
claude -c -p "query" | Continue non-interactively |
claude -r "<session>" "query" | Resume a session by ID or name |
Examples:
# Ask a one-shot question and exit
claude -p "what does src/auth/middleware.ts do?"
# Pipe a log file in for analysis
cat error.log | claude -p "find the root cause"
# Pick up yesterday's work
claude --continue
claude --resume billing-refactor
Subcommands
claude update
Update Claude Code to the latest version.
claude update
claude auth
Manage authentication.
claude auth login # sign in
claude auth login --email you@example.com # pre-fill email
claude auth login --sso # force SSO
claude auth status # auth status as JSON
claude auth status --text # human-readable
claude auth logout # sign out
claude auth status exits 0 if logged in, 1 otherwise — handy for scripts and CI checks.
claude agents
List all configured subagents, grouped by source (project, user, plugin, CLI). No interactive session needed.
claude agents
claude mcp
Configure and manage MCP servers: add, add-json, list, get, remove, reset-project-choices, login, and add-from-claude-desktop. Full syntax and examples in Claude Code — MCP.
claude mcp add --transport http notion https://mcp.notion.com/mcp
claude mcp list
claude remote-control
Start a Remote Control session so you can drive your local Claude Code from Claude.ai or the Claude app.
claude remote-control
Aliases and shortcuts
| Short | Long form |
|---|---|
claude -c | claude --continue |
claude -r | claude --resume |
claude -p | claude --print |
claude -v | claude --version |
claude -w | claude --worktree |
Notes
- Older docs mention a
claude configsubcommand; it does not appear in the current CLI reference. ? Unable to verify — use/config key=valuein-session or editsettings.jsoninstead (see Claude Code — Configuration). - Transcripts are stored under
~/.claude/projects/, so--resumeand--continuework across restarts.
Last verified: 2026-09-07
Official sources:
- https://code.claude.com/docs/en/cli-reference.md
- https://docs.claude.com/en/docs/claude-code/cli-reference
AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.