Exhaustive reference for the Claude Code command line interface. Every flag, command, option, keyboard shortcut, environment variable, and error handling — sourced from official Anthropic documentation.
⚠ Generated · as of March 2026 · not editorially reviewed
claude-codeclireferenceterminalcommands
This document is a REFERENCE — not a guide, not an overview. Every flag, every command, every option is documented. Based on official Anthropic documentation (March 2026).
Installation
Supported Platforms
Claude Code is available for:
macOS 13.0 or newer (Intel and Apple Silicon)
Linux x86_64 and aarch64 (glibc systems)
Alpine Linux and musl-based distributions (special handling required)
Windows 10/11 with Git Bash
WSL1/WSL2 on Windows
Installation Methods
Shell Installer (macOS / Linux)
curl -fsSL https://claude.ai/install.sh | bash
The script:
Checks system requirements
Auto-detects CPU architecture
Installs to ~/.local/bin/claude
Detects your shell profile and adds PATH
After installation:
Restart terminal OR
Run source ~/.zshrc / source ~/.bashrc
PowerShell Installer (Windows)
irm https://claude.ai/install.ps1 | iex
The script:
Checks system requirements
Detects Windows architecture
Installs to %USERPROFILE%\.local\bin\claude.exe
Adds to User PATH environment variable
After installation: Restart terminal.
CMD Installer (Windows)
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
Homebrew (macOS)
brew install --cask claude-code
WinGet (Windows)
winget install Anthropic.ClaudeCode
NPM (All platforms, deprecated)
npm install -g @anthropic-ai/claude-code
NPM installation is deprecated. Use the shell/PowerShell installer instead. They are 3-4x faster.
System Requirements
Requirement
Minimum
Recommended
RAM
4 GB
8+ GB
Disk
100 MB
1+ GB
macOS
13.0
Current
Linux
glibc 2.29 (Debian 10)
Current
Windows
10 Build 19041
11
WSL
WSL2 (WSL1 works, slower)
WSL2 with mirrored networking
Verification After Installation
claude --version
Should output version number, e.g., claude 2.1.42.
CLI Commands
Command
Description
Example
claude
Start interactive session
claude
claude "query"
Interactive session with initial prompt
claude "explain this project"
claude -p "query"
Print mode: Query via SDK, then exit
claude -p "explain this function"
cat file | claude -p "query"
Print mode with piped content
cat logs.txt | claude -p "analyze"
claude -c
Continue: Resume last session in current directory
claude -c
claude -c -p "query"
Continue via SDK
claude -c -p "check for errors"
claude -r "<session>" "query"
Resume: Continue session by ID or name
claude -r "auth-refactor" "Finish PR"
claude update
Update to latest version
claude update
claude auth login
Sign in to Anthropic account
claude auth login --console
claude auth logout
Sign out
claude auth logout
claude auth status
Show authentication status (JSON or text)
claude auth status --text
claude agents
List all configured subagents
claude agents
claude mcp
Configure Model Context Protocol servers
claude mcp add server
claude remote-control
Start Remote Control server (server mode)
claude remote-control --name "Project"
CLI Flags — Complete Reference
General Flags
Flag
Description
Default
Example
--version, -v
Output version number
-
claude -v
--verbose
Enable verbose logging (full turn-by-turn output)
false
claude --verbose
--help, -h
Show help
-
claude --help
--debug
Enable debug mode with optional category filtering
false
claude --debug "api,mcp"
Debug categories:
api — API calls
mcp — MCP servers
hooks — Lifecycle hooks
file — File operations
statsig — Feature flags
Negate with ! (e.g., "!statsig,!file").
Session Management
Flag
Description
Default
Example
--name, -n
Set display name for session (shown in /resume and title)
auto
claude -n "my-feature"
--continue, -c
Load most recent session in current directory
false
claude -c
--resume, -r
Resume session by ID or name, or show picker
-
claude -r auth-refactor
--fork-session
Create new session ID instead of reusing old (with --resume)
false
claude -r abc123 --fork-session
--session-id
Use specific session ID (must be valid UUID)
auto
claude --session-id "550e8400..."
--no-session-persistence
Don't save sessions to disk (print mode only)
false
claude -p --no-session-persistence "query"
--from-pr
Resume sessions linked to specific GitHub PR (number or URL)
-
claude --from-pr 123
--remote
Create new web session on claude.ai with task description
false
claude --remote "Fix Login Bug"
--remote-control, --rc
Enable Remote Control (control from claude.ai)
false
claude --remote-control "Project"
--teleport
Bring web session back to local terminal
false
claude --teleport
Directory and File Management
Flag
Description
Default
Example
--add-dir
Add additional working directories (validates existence)
-
claude --add-dir ../apps ../lib
--worktree, -w
Start isolated git worktree (in .claude/worktrees/)
-
claude -w feature-auth
Model and Agent Configuration
Flag
Description
Default
Example
--model
Set model for this session (haiku, sonnet, opus or full name)
Parent session
claude --model claude-sonnet-4-6
--effort
Set effort level (low, medium, high, max — Opus 4.6 only)
medium
claude --effort high
--fallback-model
Enable fallback to specified model when default overloaded (print mode only)
-
claude -p --fallback-model sonnet "query"
--agent
Specify agent for current session
default
claude --agent my-custom-agent
--agents
Define custom subagents dynamically via JSON
-
claude --agents '{"reviewer":{...}}'
Permission and Security
Flag
Description
Default
Example
--permission-mode
Begin in specified permission mode (default, plan, ask)