The command-line interface — commands to start, pipe, resume, and manage sessions, plus the flags worth memorizing. Grouped so they stick; see the memory aids at the bottom.
If you remember nothing else, remember these six.
-c = continue-r = resume-p = print/pipeclaude <command> — start sessions, authenticate, manage background agents, and configure MCP/plugins.
claudeclaude "explain this project"claude -p "explain this function"cat logs.txt | claude -p "explain"Three ways back into work: continue the last one, or resume a named/ID'd one.
claude -cclaude -c -p "Check for type errors"claude -r "auth-refactor" "Finish this PR"--email pre-fills, --sso forces SSO, --console uses Console/API billing.claude auth login --consoleclaude auth logout--text for readable). Exits 0 if logged in, 1 if not.claude auth statusclaude setup-tokenclaude updatestable, or latest.claude install stableManage parallel background agents the way you'd manage OS jobs: list, attach, log, stop, remove, restart.
--json for scripting; --cwd, --model, --permission-mode, --effort, --agent set defaults.claude agents --jsonclaude attach 7c5dcf5dclaude logs 7c5dcf5d--all for every one.claude respawn 7c5dcf5dclaude kill.claude stop 7c5dcf5dclaude rm 7c5dcf5dclaude daemon status--keep-workers leaves sessions running.claude daemon stop --any --keep-workers--no-browser over SSH. (v2.1.186+)claude mcp login sentryclaude mcp logout sentryclaude plugins).claude plugin install code-review@claude-plugins-officialclaude remote-control --name "My Project"--dry-run previews, -y skips confirm, --all for every project.claude project purge ~/work/repo --dry-runclaude auto-mode defaults > rules.json--json for raw payload, --timeout <min>. Exits 0/1.claude ultrareview 1234 --jsonclaude --help doesn't list every flag — absence from --help doesn't mean it's unavailable. A curated, memorable set:
The short flags spell what they do: -p print, -c continue, -r resume.
claude -p "..."claude --continueclaude -r "auth-refactor"model setting).claude --model claude-sonnet-5low/medium/high/xhigh/max (session only, doesn't persist).claude --effort highagent setting).claude --agent my-custom-agentplan, acceptEdits, auto, bypassPermissions.claude --permission-mode plan.claude/ config.claude --add-dir ../apps ../lib"Bash(git log *)" "Read""Bash(rm *)" "Edit"--permission-mode bypassPermissions.Shift+Tab cycle without starting in it.--append-system-prompt "Always use TypeScript"--append-system-prompt-file ./extra-rules.txtprompt).--agents '{"reviewer":{...}}'claude --bare -p "query"-p.claude --bg "investigate the flaky test"agents, auth status, ultrareview): machine-readable output for scripting.claude agents --json"api,mcp" or "!statsig".claude --debug "api,mcp"claude --debug-file /tmp/claude-debug.logclaude --disable-slash-commandsopus, sonnet, or fable. (v2.1.98+)claude --advisor opusclaude --betas interleaved-thinkingclaude --chromeclaude --cloud "Fix the login bug"claude --ax-screen-readerBoth are common in automation, but they strip away different layers. --dangerously-skip-permissions suppresses permission prompts; -p --bare minimizes the startup environment. Knowing which does what is the difference between a script that runs and one that hangs.
What it does: Sets the permission tier to bypassPermissions. Claude reads/writes files and runs bash commands without ever asking for approval.
The catch: The full feature set stays on: it scans for CLAUDE.md, loads plugins/skills, reads settings and conversation history, and uses your OAuth / Keychain credentials.
What it does: Skips the heavy discovery phase: no hooks, skills, plugins, MCP, auto-memory, or CLAUDE.md. -p runs one-shot (headless). Community reports it also leans on ANTHROPIC_API_KEY rather than OAuth/Keychain.
The catch: Permissions are NOT bypassed. If Claude tries to run a command, it still asks — so in a non-interactive pipe it will hang or fail unless you add a permission flag.
| Capability | --dangerously-skip-permissions | -p --bare |
|---|---|---|
| Primary goal | Stop permission-prompt fatigue | Fast, clean, isolated script runs |
| Interactive UI | Yes — standard TTY terminal | No — one-shot execution |
| Prompts / approvals | Bypassed — 100% autonomous | Active — still needs approvals |
| Auth source | System Keychain / web OAuth | ANTHROPIC_API_KEY env var |
| Reads project context | Yes — CLAUDE.md & history | No — clean slate |
| Speeds up startup | No | Yes — skips lookups |
For a CI/CD job or cron task that must run fast, without human auth, and fully autonomously, neither flag is enough alone — combine all three.
claude -p "Refactor the helper functions in src/utils.ts" --bare --dangerously-skip-permissions
--bare — skips browser popups and boots instantly.-p — pipes your direct text request in and runs one-shot.--dangerously-skip-permissions — stops it freezing while it waits for a human to type “yes”.-p = print (headless), -c = continue (most recent), -r = resume (by name/ID).agents (list) · attach · logs · stop/kill · rm · respawn — the same verbs you'd use on OS jobs.claude auth login / logout / status, plus setup-token for CI.--dangerously-…** (e.g. --dangerously-skip-permissions). Easy to spot in scripts and reviews.claude -p "…" --output-format json for scripts; add --bare to skip discovery and start faster.claude udpate → “Did you mean claude update?”) and exits without starting.Summarized from the official Claude Code CLI reference (code.claude.com/docs/en/cli-reference) for study. A curated selection — check the live docs for the full command and flag list.