Claude Terminal Commands

Reference Sheet

Claude Code Terminal Commands Reference

Use this page as a quick command launcher for Claude Code. Commands are ordered from the ones most people use first to the more specialized ones later. Each card shows the command name, what it does, and a full example you can copy directly with the button on the right. Replace any placeholder text like file names, prompts, paths, session names, or PR numbers before running it in your terminal.

Most Popular Claude CLI Commands

claude

Start an interactive Claude Code session in the current project.

claude
claude "query"

Start Claude with an initial prompt already provided.

claude "give me an overview of this codebase"
claude -p "query"

Run a single prompt non-interactively, print the result, then exit.

claude -p "explain what this repository does"
cat file | claude -p "query"

Pipe file content into Claude for quick analysis or summarization.

cat build-error.txt | claude -p "concisely explain the root cause of this build error"
claude --continue

Continue the most recent conversation in the current directory.

claude --continue
claude --resume

Open the conversation picker or resume a named/session-specific conversation.

claude --resume auth-refactor
claude -n <name>

Start a session and give it a memorable name for easier resuming later.

claude -n auth-refactor
claude --output-format json

Return structured JSON output for scripting and automation workflows.

cat code.py | claude -p "analyze this code for bugs" --output-format json > analysis.json
claude --output-format text

Return plain text output explicitly for scripts and redirection.

cat data.txt | claude -p "summarize this data" --output-format text > summary.txt
claude --output-format stream-json

Stream JSON events in real time while Claude processes the request.

cat log.txt | claude -p "parse this log file for errors" --output-format stream-json

Interactive Slash Commands

/help

Show available slash commands inside an active Claude session.

/help
/init

Generate a starter CLAUDE.md file for the current project.

/init
/resume

Switch to a different saved conversation from inside Claude.

/resume
/rename

Rename the current session so it is easier to find later.

/rename auth-refactor
/config

Open Claude Code settings and configuration options.

/config
/permissions

Review and adjust permission rules for tools and domains.

/permissions
/hooks

Inspect or configure hooks tied to Claude Code lifecycle events.

/hooks
/doctor

Run installation and environment diagnostics.

/doctor
/agents

Configure or inspect custom subagents.

/agents
/compact

Compact conversation context when a session becomes long.

/compact

Install, Setup, and Integrations

Native install (macOS / Linux / WSL)

Install Claude Code with the recommended shell installer.

curl -fsSL https://claude.ai/install.sh | bash
Homebrew install

Install Claude Code on macOS with Homebrew stable channel.

brew install --cask claude-code
Windows PowerShell install

Install Claude Code from PowerShell.

irm https://claude.ai/install.ps1 | iex
Windows CMD install

Install Claude Code from Command Prompt.

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
MCP server add

Connect an MCP server so Claude can use external tools and data sources.

claude mcp add my-server -- npx -y @modelcontextprotocol/server-filesystem /path/to/project

Popular Workflow Examples

Review current project

Start Claude and ask for a high-level architectural summary.

claude "give me an overview of this codebase and identify the main architecture patterns"
Find authentication code

Ask Claude to locate files relevant to a feature area.

claude "find the files that handle user authentication and explain how they work together"
Type-check continuation

Continue a prior session and give a precise next task.

claude --continue -p "check for type errors introduced by the latest changes"
PR-linked work

Resume work associated with a specific pull request number.

claude --from-pr 123
Package.json lint hook

Use Claude as a scripted lint/review step inside package.json.

"lint:claude": "claude -p 'you are a linter. please look at the changes vs. main and report any issues related to typos. report the filename and line number on one line, and a description of the issue on the second line. do not return any other text.'"