Complete Claude Code CLI Reference
Every command, flag, keyboard shortcut, and interactive feature in Claude Code.
CLI Commands
Core commands to interact with Claude Code from the terminal.
Interactive Session
claude β Start an interactive conversation
One-Shot Query
claude "your question" β Quick inline query
Print Mode (Non-Interactive)
claude -p "query" β Output response and exit. Perfect for scripts and piping.
Interactive Mode
Keyboard shortcuts and interactive features available during a Claude session.
Plan Mode (Shift+Tab)
Toggle Plan Mode to make Claude think and plan before writing code. Claude explores, analyzes, and proposes a plan for your approval.
Voice Dictation & Bash Mode
Hold Space for voice dictation. Type ! for inline shell commands. Use @ for file references.
Keyboard Shortcuts
Ctrl+C: Cancel. Ctrl+G: Fuzzy search. Ctrl+B: Background agent. Ctrl+T: Task list. Shift+Tab: Plan Mode.
Advanced Features
Power features for advanced workflows and automation.
Extended Thinking
Use 'think', 'think hard', 'think harder', or 'ultrathink' to activate deeper reasoning. More thinking budget = more thorough analysis for complex problems.
Project Memory (CLAUDE.md)
Create CLAUDE.md files to store project rules, conventions, and context. Claude reads these automatically. Keep them short, specific, and regularly pruned.
Checkpoints & Rewind
Claude automatically creates checkpoints. Use /rewind to go back to any previous state if something goes wrong.
Latest in Claude Code
β‘Agent Teams
Run parallel agent teams with shared task lists and mailboxes
πBackground Subagents
Run agents in background with Ctrl+B, check results later
π―MCP Tool Search
Auto-deferred MCP tools save context window space
β¨οΈCustom Keybindings
Customize all keyboard shortcuts via /keybindings
πDesktop & Web
Desktop App for macOS/Windows and Web at claude.ai/code
πWorktree Isolation
Run agents in isolated git worktrees with --worktree flag
CLI Flags & Options
Comprehensive list of CLI flags and options for customizing Claude Code behavior.
Model & Execution Flags
--model (-m): Select model. --effort: Set thinking effort. --max-turns: Limit turns. --max-budget-usd: Set spending cap. --agent: Use a subagent.
System Prompt & Output Flags
--system-prompt: Override prompt. --output-format (text/json/stream-json): Control output. --json-schema: Validate JSON.
Tool & Session Flags
--allowedTools/--disallowedTools: Control tools. --worktree: Git isolation. --chrome: Chrome integration. --plugin-dir: Load plugins.
Practical Command Examples
Exploration
claude> analyze the overall structure of this projectclaude> document the API endpointsDevelopment
claude> add user profile editing functionalityclaude> run all tests and analyze failure causesCLI Tips
Be Specific
Instead of 'fix the error', say 'fix the null reference error in the handleSubmit function in user.tsx'.
Use Plan Mode First
Press Shift+Tab to enable Plan Mode. Let Claude explore and plan before making changes.
Manage Context
Use /clear to start fresh, /compact to compress, and /btw for side questions. Keep CLAUDE.md short and specific.