Originally published at claudeguide.io/claude-code-cli-commands
Claude Code CLI Commands: Full Reference (2026)
Claude Code is primarily a conversational tool, but it has a rich set of CLI flags, in-session slash commands, and keyboard shortcuts that change how it behaves. This is the complete reference. For a broader introduction to what Claude Code can do, visit the Claude Code Complete Guide in 2026.
CLI flags (when launching claude)
These flags are passed when you start Claude Code from the terminal.
Basic flags
| Flag | Description | Example |
|---|---|---|
--help, -h
|
Show help text | claude --help |
--version, -v
|
Show installed version | claude --version |
--print, -p
|
Print response and exit (non-interactive) | claude -p "Explain this file" < main.ts |
--output-format |
Set output format for -p mode |
claude -p "..." --output-format json |
Model and configuration
| Flag | Description | Example |
|---|---|---|
--model |
Override the model for this session | claude --model claude-sonnet-4-6 |
--config |
Path to a custom settings file | claude --config ./team-settings.json |
--system-prompt |
Inject a one-off system prompt | claude --system-prompt "You are a security auditor" |
Context and files
| Flag | Description | Example |
|---|---|---|
--context |
Add extra context text | claude --context "$(cat NOTES.md)" |
--allowed-tools |
Restrict which tools Claude can use | claude --allowed-tools Read,Grep |
--disallowed-tools |
Block specific tools | claude --disallowed-tools Bash,Write |
Permissions and safety
| Flag | Description | Example |
|---|---|---|
--dangerously-skip-permissions |
Skip all tool-use permission prompts | claude --dangerously-skip-permissions |
--permission-mode |
Set permission level (default/bypassPermissions) | claude --permission-mode bypassPermissions |
Warning: --dangerously-skip-permissions and bypassPermissions disable all confirmation prompts. Use only in trusted automated environments where you have reviewed the task in advance.
Session control
| Flag | Description | Example |
|---|---|---|
--resume |
Resume a previous session by ID | claude --resume abc123def |
--continue, -c
|
Continue the most recent session | claude -c |
--max-turns |
Limit the number of agentic turns | claude --max-turns 5 |
Non-interactive (pipe) mode
Claude Code can be used in scripts and CI pipelines without an interactive terminal. Use -p with stdin:
# Read a file and ask a question about it
cat main.ts | claude -p "What does this file do? List the exported functions."
# Pipe multiple files
cat src/auth.ts src/middleware.ts | claude -p "Find any security issues in these files."
# Save output to a variable
REVIEW=$(git diff HEAD~1 | claude -p "Review this diff for bugs.")
echo "$REVIEW"
# JSON output for programmatic use
git diff | claude -p "List any breaking changes as JSON" --output-format json
In-session slash commands
Once Claude Code is running, these commands are typed in the conversation input.
Session management
| Command | Description |
|---|---|
/help |
Show help and available commands |
/quit, /exit
|
Exit Claude Code |
/clear |
Clear conversation history (new context) |
/compact |
Compact conversation to reduce token usage |
/status |
Show session info: model, token count, settings |
/cost |
Show token usage and estimated cost for this session |
Model switching
| Command | Description |
|---|---|
| `/model <name |
40 slash command templates. Token-optimized variants. JSONL file for direct import. Tested in production sessions.
→ Get Claude Code Power Prompts 300 — $29
30-day money-back guarantee. Instant download.
Top comments (0)