Part ofWhat Is Claude Code? The Complete Guide
Claude Code CLI documentation in one page: install, core commands, flags, slash commands, settings.json hierarchy and a practical cheatsheet.
In This Article
10 sectionsThe Claude Code CLI documentation covers a single tool: claude, Anthropic's agentic coding agent that lives in your terminal. You launch it by typing claude, steer each run with flags like --model and --permission-mode, and drive a live session with slash commands such as /init and /compact. Installing it needs no admin rights.
We build and maintain this site with Claude Code every day, and the questions we field most are never conceptual — they're "what's the flag for that again?" This Claude Code CLI documentation is the crib sheet we wish we'd had: the commands, flags, slash commands, and configuration that actually come up in daily work, cross-checked against the official CLI reference. New to the tool itself? Start with our pillar, What Is Claude Code?, then keep this open in a second tab.
What the Claude Code CLI is
Claude Code is a command-line agent, not a chat box bolted onto an editor. You run claude inside a project, and it reads your files, edits them, runs shell commands, and handles git through plain-English requests — pausing to ask permission before anything destructive. There's no separate GUI to learn; the terminal is the interface. The whole of the Claude Code CLI documentation fits that shape: a few commands to start and manage sessions, a set of flags that tune each run, and slash commands you type mid-conversation.
Install Claude Code (Node.js optional)
Installation is one line and needs no administrator rights. Pick the method that matches your shell:
- macOS, Linux, WSL:
curl -fsSL https://claude.ai/install.sh | bash - Windows PowerShell:
irm https://claude.ai/install.ps1 | iex - npm (any OS):
npm install -g @anthropic-ai/claude-code
The native installer bundles its own runtime, so it needs no Node.js at all — only the npm route requires Node.js 18 or later. On native Windows, install Git for Windows so Claude Code can use its Bash tool; without it, the agent falls back to PowerShell. The system requirements are modest: Windows 10 (1809+), macOS 13+, or a mainstream Linux, 4GB of RAM, and an internet connection, per Anthropic's setup guide. Confirm the install with claude --version, and run claude doctor if anything looks off.
On first launch, claude opens your browser to sign in. You can also manage authentication from the shell: claude auth login signs in or switches accounts, claude auth status reports whether you're logged in, and claude auth logout clears stored credentials.
Core Claude Code commands
Most of the Claude Code CLI documentation you'll ever need reduces to a dozen commands. These are the ones we type without thinking:
| Command | What it does |
|---|---|
claude | Start an interactive session in the current directory |
claude "query" | Launch straight into a first prompt |
claude -p "query" | Headless (print) mode: answer, then exit — for scripts and pipes |
claude -c | Continue the most recent conversation here |
claude -r "<id>" | Resume a session by ID or name |
claude update | Update to the latest version |
claude mcp | Add and manage MCP servers |
claude doctor | Diagnose installation and config problems |
claude auth login | Sign in or switch Anthropic accounts |
Two of these do the heavy lifting. claude -c picks up yesterday's thread without re-explaining anything, and claude -p turns the agent into a Unix citizen you can pipe into: cat error.log | claude -p "explain the root cause" prints an answer and exits.
Essential Claude Code flags
Flags modify a single launch. claude --help deliberately doesn't list every one — a flag's absence from --help doesn't mean it's gone — which is exactly why a written reference earns its keep here.
| Flag | Purpose |
|---|---|
--model <alias> | Set the model: sonnet, opus, haiku, or a full ID |
--permission-mode <mode> | Start in plan, acceptEdits, auto, or another mode |
--print, -p | Non-interactive output for scripts and CI |
--output-format <fmt> | text, json, or stream-json (print mode) |
--continue, -c | Reload the latest conversation in this directory |
--resume, -r | Resume a specific session, or open the picker |
--add-dir <path> | Grant read and write access to extra directories |
--fallback-model <list> | Fail over to another model when the primary is overloaded |
--dangerously-skip-permissions | Skip every permission prompt (use with care) |
--verbose | Show full turn-by-turn output |
The --model aliases resolve to the current release — opus to Claude Opus 4.8, sonnet to Claude Sonnet 5, haiku to Claude Haiku 4.5 — so you rarely type a full model ID. When a model is overloaded, --fallback-model sonnet,haiku keeps the run alive by trying each in order. Which model to reach for is its own decision; our Claude models guide breaks down the trade-offs.
Slash commands: driving a live session
Once a session is running, you steer it with slash commands typed at the prompt — the layer of the Claude Code CLI documentation you'll touch most. Type / alone to see every one available to you. These are the essentials:
| Command | What it does |
|---|---|
/init | Generate a starter CLAUDE.md for the project |
/clear | Start a fresh conversation, keeping project memory |
/compact | Summarize the conversation to reclaim context |
/resume | Return to an earlier session |
/model | Switch models mid-session |
/config | Open settings (theme, model, output style) |
/permissions | Manage allow, ask, and deny rules |
/mcp | Connect and authenticate MCP servers |
/context | Visualize what's filling the context window |
/doctor | Diagnose installation and configuration |
/init is where every project should start — it writes a CLAUDE.md the agent reads on every future session (more on that file below). For a big change, /plan drops into read-only plan mode, which we cover in depth in Claude Planner. And /skills lists the reusable instruction folders that extend the agent — see Claude Code Skills for building your own.
CLAUDE.md and the config hierarchy
The other half of the Claude Code CLI documentation is configuration — where settings live and which file wins. Start with CLAUDE.md: a plain Markdown file at your project root that Claude Code reads at the top of every session. Your stack, conventions, and rules stay in context automatically. Run /init to generate one, then edit in what matters. It's the single highest-leverage file in the whole setup.
Settings themselves live in settings.json files, and four scopes stack in a fixed order. When two files set the same key, the higher one wins:
- Managed — IT-deployed policy (
managed-settings.json); cannot be overridden. - Command-line flags —
--settings,--model, and friends; this run only. - Local —
.claude/settings.local.json; personal and gitignored. - Project —
.claude/settings.json; committed and shared with the team. - User —
~/.claude/settings.json; your defaults across every project.
The pattern we use: commit team conventions to project settings, keep personal keys — a custom model, extra permissions.allow rules — in local settings, and let managed settings enforce whatever security requires.
Permission modes, from plan to bypass
Every session runs in a permission mode, set with --permission-mode at launch or cycled with Shift+Tab mid-session. Six exist:
- default — asks before each edit or command.
- acceptEdits — auto-approves file edits, still asks for commands.
- plan — read-only; researches and proposes, changes nothing.
- auto — a classifier approves safe actions and asks on risky ones.
- dontAsk — runs without prompts inside your allowlist.
- bypassPermissions — skips every check; identical to
--dangerously-skip-permissions.
We live in plan mode for anything unfamiliar and auto for well-scoped work. --dangerously-skip-permissions earns its scary name, so we reserve it for throwaway sandboxes where nothing important can break.
Power-user commands worth knowing
A few corners of the Claude Code CLI documentation reward the minute it takes to find them:
/rewindrolls both code and conversation back to an earlier checkpoint — the undo button for a run that went sideways.--worktree(-w) starts the session in an isolated git worktree, so a risky change never touches your main checkout.--agents '{...}'defines a custom subagent inline as JSON, with no config file to create.claude --bg "task"launches a background agent and hands your terminal straight back.--append-system-prompt "..."bolts one extra rule onto the default system prompt for a single run.claude setup-tokenmints a long-lived token for CI, where nobody can sit through a browser login.
Claude Code CLI documentation cheat sheet
Here's the one-screen version — the commands we reach for most, worth pinning next to the terminal. Bookmark the full Claude Code CLI documentation for the long tail.
| Task | Command |
|---|---|
| Install (Windows) | irm https://claude.ai/install.ps1 | iex |
| Install (macOS/Linux) | curl -fsSL https://claude.ai/install.sh | bash |
| Start a session | claude |
| One-shot / headless | claude -p "query" --output-format json |
| Continue last session | claude -c |
| Plan mode from launch | claude --permission-mode plan |
| Pick a model | claude --model opus |
| Generate CLAUDE.md | /init |
| Reclaim context | /compact |
| Diagnose problems | claude doctor |
Keep those ten within reach and you can run most of a working day without touching a menu. Everything else is one / away.
Claude pricing at a glance
| Plan | Price |
|---|---|
| Free | $0 |
| Pro | $20 / month |
| Max | from $100 / month |
| API | Pay per token |
For the full breakdown of every plan, see our how much Claude costs guide.
Frequently Asked Questions

Written by
InnovateTechie
Writing about Claude and the Anthropic toolkit — models, Claude Code, pricing, features, and fixes, in clear, practical, hands-on guides tested by daily use.
View all posts →





