AI agents

Claude Code

Claude Code — CLI Commands

Terminal commands vs slash commands

  • claude ... is a shell command — you run it in your terminal, before/outside a session.
  • /command is a slash command — you type it inside an interactive Claude Code session.

They overlap on purpose: claude update runs in the shell, /upgrade runs in a session; claude mcp add configures servers, /mcp manages 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

CommandWhat it does
claudeStart 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 -cContinue 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

See Claude Code — Subagents.

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

ShortLong form
claude -cclaude --continue
claude -rclaude --resume
claude -pclaude --print
claude -vclaude --version
claude -wclaude --worktree

Notes

  • Older docs mention a claude config subcommand; it does not appear in the current CLI reference. ? Unable to verify — use /config key=value in-session or edit settings.json instead (see Claude Code — Configuration).
  • Transcripts are stored under ~/.claude/projects/, so --resume and --continue work across restarts.

Last verified: 2026-09-07

Official sources:

AI coding tools evolve quickly. If you find outdated information, please open an issue or pull request.