Skip to main content

CLI Commands

Complete reference for Claude Code commands and slash commands.

This page documents all the ways to invoke and control Claude Code: command-line arguments for starting sessions, slash commands for in-session control, keyboard shortcuts for efficiency, and special syntax like @ mentions.


CLI Arguments

These options control how Claude Code starts. Use them when launching from your terminal:

claude [options] [prompt]
OptionDescription
-c, --continueResume last conversation
-p, --printNon-interactive mode (print and exit)
--resume <id>Resume specific session
--chromeLaunch with Chrome integration
--model <model>Use specific model
--versionShow version
--helpShow help

Slash Commands

Slash commands are available during a session. Type / to see all available commands. They're organized by function:

Session Management

Control your conversation state:

CommandDescription
/clearReset conversation, start fresh
/compact [instructions]Summarize conversation to free context — use when context is filling up
/rewindRoll back to previous checkpoint — undo recent changes
/resumeContinue a previous session

Configuration

CommandDescription
/configOpen settings menu
/modelSwitch between Claude models
/permissionsManage tool permissions
/hooksConfigure event hooks
/memoryEdit CLAUDE.md files
/initGenerate CLAUDE.md from codebase

Tools & Integrations

CommandDescription
/mcpManage MCP servers
/pluginManage plugins
/install-github-appSet up GitHub integration
/code-reviewReview code changes

Help & Info

CommandDescription
/helpShow all commands
/statusShow session status
/costShow token usage

Keyboard Shortcuts

These shortcuts work during a session. Learning them speeds up your workflow:

ShortcutAction
Esc (once)Cancel current action
Esc EscOpen rewind menu — most useful shortcut for undoing
Shift+TabCycle through modes (normal → plan → auto-accept)
Ctrl+CInterrupt/exit
TabAutocomplete
↑/↓Navigate history

@ Mentions

Reference files and resources directly in your prompts with @. This ensures Claude includes them in context:

@src/utils/auth.ts      # Specific file
@src/components/ # Directory
@https://example.com # URL (with MCP)

Context Modifiers

Special prefixes that change how Claude interprets your input:

# Add instruction to memory
# Always use TypeScript strict mode

? Ask a question without executing
? what would happen if I deleted this?

Examples

Common patterns for using Claude Code effectively:

Start with specific task

claude "refactor the auth module to use JWT"

Resume and continue

claude -c "now add tests for what we built"

Pipe input

git diff | claude -p "review these changes"
cat error.log | claude -p "explain and fix this error"

Non-interactive script

claude -p "generate a README for this project" > README.md