# Claude Code CLI Reference
## Ways to use Claude Code
By default, Claude Code is used through an interactive session (REPL), where a CLI GUI enables entering prompts and commands. It's also possible to use it non-interactively, using the `-p` or `--print` CLI flag: `claude -p "Summarize this codebase"`.
## CLI Commands
```
config Manage configuration (eg. claude config set -g theme dark)
mcp Configure and manage MCP servers
migrate-installer Migrate from global npm to local installation
doctor Check health of Claude Code auto-updater
update Check for updates and install if available
```
## CLI Flags
```
-p, --print Print response and exit (useful for pipes)
-c, --continue Continue the most recent conversation
-r, --resume [sessionId] Resume a conversation by session ID
-n, --name <name> Name the session
-w, --worktree <name> Run in an isolated git worktree
-d, --debug Enable debug mode
--verbose Override verbose mode setting from config
--bare Minimal headless mode (no hooks, no LSP)
--model <model> Model for the session (e.g. 'sonnet', 'opus')
--effort <level> Set effort: low, medium, high, xhigh, max, auto (xhigh is the recommended default on Opus 4.7)
--permission-mode <mode> Set permission mode: default, acceptEdits, plan, auto, bypassPermissions, dontAsk
--output-format <format> Output format (with --print): "text", "json", "stream-json"
--input-format <format> Input format (with --print): "text", "stream-json"
--json-schema <schema> Structured output with a JSON schema (with --print)
--max-turns <n> Limit agentic turns
--max-budget-usd <n> Cost cap per session
--allowedTools <tools...> Tool names to allow (e.g. "Bash(git:*) Edit")
--disallowedTools <tools...> Tool names to deny
--dangerously-skip-permissions Bypass all permission checks (sandboxes only)
--mcp-config <file or string> Load MCP servers from JSON file or string
--add-dir <directories...> Additional directories to allow tool access to
--agent <file> Use an agent definition (.md file)
--channels <plugins...> Enable channel plugins for push messaging
--remote Start a web session on claude.ai/code
--teleport [sessionId] Pull a web session into local terminal
--chrome Enable Chrome browser integration
--console Authenticate via Anthropic Console (API key)
-v, --version Output the version number
-h, --help Display help for command
```
## Non-interactive usage
- Pipe data in: `cat foo.txt | claude -p "Summarize this"`
- Automate CI/infra: `claude --print "update the README" --allowedTools "Bash(git diff:*)" "Bash(git log:*)" Write`
## References
- CLI usage: https://docs.anthropic.com/en/docs/claude-code/cli-usage
## Related
- [[Claude Code]]
- [[Claude Code Interactive Mode]]
- [[Claude Code SDK]]