Back to Blog
claude-codedeveloper-toolsaiterminalproductivitycheat-sheet

Claude Code Command Reference

Your Terminal Copilot Cheat Sheet

By Mathieu Kessler15 min read

What is Claude Code?

Claude Code is Anthropic's agentic coding tool that lives in your terminal. It's not just another AI assistant—it's your AI pair programmer that can read files, write code, run commands, and create commits. Think of it as having a senior engineer available 24/7 to help you build features, debug issues, and refactor code.

Getting Started

Installation & Setup

# Install Claude Code
npm install -g @anthropic-ai/claude-code

# Start Claude Code in your project
cd /path/to/your/project
claude

# First time? You'll need to log in
# Supports both Claude.ai and Claude Console accounts

Windows Users:

Claude Code works on Windows 10+ through WSL 1 or WSL 2 (recommended) or Git Bash (native alternative). For WSL users experiencing file system performance issues, you can run Claude Code natively on Windows instead.

Essential Keyboard Shortcuts

Platform Compatibility: Claude Code works on macOS 10.15+, Linux (Ubuntu 20.04+/Debian 10+), and Windows 10+ (via WSL 1/2 or Git Bash).

Tip: Press ? in Claude Code to see shortcuts specific to your platform.

ShortcutDescriptionContext
Shift + TabToggle permission modesCycles: Normal → Auto-Accept → Plan Mode
TabToggle extended thinkingEnable/disable deeper reasoning
Esc + EscEdit previous messageDouble-escape to modify last prompt
Ctrl + CCancel current operationStop generation or tool execution
Ctrl + LClear terminal screenKeeps conversation history intact
Ctrl + RSearch command historyFind and reuse previous commands
Up/DownNavigate command historyRecall previous inputs
?Show all shortcutsContext-aware help menu

Plan Mode: The Game-Changer

What is Plan Mode?

Plan Mode is Claude Code's killer feature that separates research and planning from execution. Press Shift + Tab twice to activate it. In this mode, Claude can only read and analyze—it cannot modify files, run commands, or make any changes until you approve the plan.

How to Use Plan Mode

1

Activate Plan Mode

Press Shift + Tab twice. You'll see ⏸ plan mode on at the bottom.

2

Describe Your Task

> "Plan the implementation of user authentication using OAuth2"
> "Analyze the current database schema and plan optimizations"
> "Create a plan to refactor the payment processing module"
3

Review the Plan

Claude researches your codebase and presents: task breakdown, files to be modified, execution order, and potential edge cases.

4

Exit Plan Mode & Execute

Claude calls exit_plan_mode when ready. Accept, ask follow-up questions, or provide different direction.

Read-Only Tools (Allowed)

  • Read - View file contents
  • LS - List directory contents
  • Glob - Search file patterns
  • Grep - Search file contents
  • WebFetch - Fetch web content
  • WebSearch - Search the web
  • Task - Launch research subagents
  • TodoRead - Read task lists

Blocked Until Approved

  • Edit/MultiEdit - File modifications
  • Write - File creation
  • Bash - Command execution
  • Any MCP tools - That modify state

Use Plan Mode for: Complex architecture, multi-file refactoring, exploring unfamiliar codebases, validating approaches.

CLI Flags for Plan Mode

# Start a new session in Plan Mode
claude --permission-mode plan

# Set Plan Mode as default in settings
# Add to .claude/settings.json:
{
  "permissions": {
    "defaultMode": "plan"
  }
}

# Run a headless query in Plan Mode
claude -p "Plan the authentication system" --permission-mode plan

Essential CLI Commands

CommandDescriptionExample
claudeStart interactive sessionclaude
claude --continueContinue most recent conversationclaude --continue
claude --resumeShow conversation pickerclaude --resume
claude -p "query"Print mode (headless)claude -p "Run tests"
claude updateUpdate to latest versionclaude update
claude --add-dirAdd additional directoriesclaude --add-dir ../lib

IDE Integration

VS Code & JetBrains Shortcuts

ActionmacOSWindows/Linux
Insert file reference (@File)Cmd+Option+KAlt+Ctrl+K
Quick launch (JetBrains)Cmd+EscCtrl+Esc
Multiline inputOption+Enter\ + Enter

Interactive Slash Commands

Type / at the start of your message to access slash commands:

/config Open settings
/help Show commands
/model Switch AI model
/login Switch accounts
/clear Clear history
/vim Vim-style editing
/ide Connect to IDE
/init Generate CLAUDE.md
/terminal-setup Configure multiline

Creating Custom Slash Commands

# Project-wide command (.claude/commands/)
mkdir -p .claude/commands
echo "Review this code for security vulnerabilities:" > .claude/commands/security.md

# Personal command (~/.claude/commands/)
mkdir -p ~/.claude/commands
echo "Analyze code performance and suggest optimizations:" > ~/.claude/commands/optimize.md

# Use your custom command
> /security
> /optimize

Extended Thinking Mode

Enable deeper reasoning for complex problems:

Toggle with Tab key

Press Tab to enable/disable extended thinking

Use prompts with thinking levels

> "think about the best approach"
> "think hard about edge cases"
> "think harder about the architecture"
> "ultrathink about the security implications"

Enable permanently

// In .claude/settings.json:
{
  "MAX_THINKING_TOKENS": 10000
}

File References & Context

@ Reference Syntax

# Include specific files
> Explain the logic in @src/utils/auth.js

# Include directories
> Review the tests in @tests/

# Include GitHub issues (via MCP)
> Show me the data from @github:repos/owner/repo/issues

# Include multiple references
> Compare @src/old-api.js with @src/new-api.js

# Memory Shortcut

Type # at the start of your message. Claude will prompt for file selection and add context to CLAUDE.md (project memory).

Model Selection

# Switch models during session
/model opus      # Claude Opus 4.1/4 (best reasoning)
/model sonnet    # Claude Sonnet 4/4.5 (balanced)
/model haiku     # Claude Haiku 4.5 (fastest)
/model opusplan  # Hybrid: Opus for planning, Sonnet for execution

# Set model via CLI
claude --model opus

# Configure in settings
{
  "model": "opus"
}

Pro Tip: Use opusplan to get Opus reasoning for planning with Sonnet efficiency for execution. Best of both worlds!

Permission Modes

ModeIndicatorBehavior
Normal Mode(default)Claude asks permission for each file edit
Auto-Accept Mode⏵⏵ accept edits onAutomatically approves all file edits
Plan Mode⏸ plan mode onRead-only: no edits until plan approved

Toggle between modes: Press Shift + Tab to cycle through them

Best Practices From the Field

1

Start with Plan Mode

For any non-trivial feature, start in Plan Mode. It's easier to change a plan than to change code mid-implementation.

2

Use Extended Thinking for Complex Problems

Architecture decisions, performance optimizations, and security reviews benefit from "think hard" or "ultrathink" prompts.

3

Leverage CLAUDE.md for Project Context

Run /init to generate a CLAUDE.md file with your project overview. Claude reads this automatically at session start.

4

Interrupt and Course-Correct

Press Esc to interrupt at any time. Double-tap Esc + Esc to edit your previous prompt and try a different approach.

5

Use the Hybrid opusplan Model

Get Opus reasoning for planning with Sonnet efficiency for execution. Best of both worlds.

6

Integrate with Your IDE

Use /ide to connect Claude Code to VS Code or JetBrains. Share selections, view diffs in your editor, and get automatic diagnostic sharing.

Advanced Workflows

Test-Driven Development with Claude

1. Enter Plan Mode (Shift+Tab twice)
2. > "Plan comprehensive tests for the user authentication module"
3. Review and approve the test plan
4. > "Write the tests first, don't implement anything yet"
5. > "Run the tests and confirm they fail"
6. > "Now implement the authentication to make tests pass"
7. > "Commit the changes with a descriptive message"

Parallel Development with Git Worktrees

# Create worktrees for parallel Claude Code sessions
git worktree add ../project-feature-a -b feature-a
git worktree add ../project-bugfix -b bugfix-123

# Run Claude Code in each worktree
cd ../project-feature-a && claude
# In another terminal:
cd ../project-bugfix && claude

# Each instance works independently without conflicts

CI/CD Integration (Headless Mode)

# Use in pre-commit hooks
claude -p "Review staged changes for issues"

# Use in CI pipelines
claude -p "Run tests and report failures" --output-format json

# Automated code review
cat error.log | claude -p "Analyze this error log and suggest fixes"

Pro Tips

  • Multiline Input (Universal): Type \ followed by Enter works on all platforms
  • Multiline Input (macOS): Option+Enter works by default
  • Multiline Input (Setup): Run /terminal-setup to configure Shift+Enter for iTerm2 and VS Code
  • Context Priming: For large codebases, use @ references to load relevant files before asking questions
  • Save Plans: Have Claude save important plans to docs/PLAN.md for version control
  • MCP Integration: Connect Claude Code to Google Drive, Slack, Jira, and more via Model Context Protocol
  • Custom Agents: Define specialized subagents for security reviews, code optimization, or documentation

Security Note

Always review plans and code changes before approval, especially in production environments. Plan Mode is your safety net—use it for any changes that could have significant impact.

Sources & Further Reading

This reference guide is based on the Official Anthropic Documentation (November 2025). All commands and features have been verified against the latest Claude Code release.