reference commands cheat-sheet

Claude Code Terminal Commands: The Ultimate Cheat Sheet

Complete reference for all Claude Code CLI commands, flags, and slash commands. Bookmark this cheat sheet for quick access during your coding sessions.

Updated: February 6, 2026 5 min read

Quick Reference

Bookmark this page — it’s the only Claude Code command reference you’ll need.

CLI Commands

Starting Claude Code

CommandDescription
claudeStart a new interactive session
claude --continueContinue the last conversation
claude --resumeResume a previous session (interactive picker)
claude --print "query"One-shot mode — print answer and exit
claude --dangerously-skip-permissionsSkip permission prompts (use with caution)

Installation & Updates

CommandDescription
claude --versionDisplay current version
claude doctorRun health diagnostics
claude updateUpdate to latest version
claude installMigrate npm install to native

Configuration

CommandDescription
claude configOpen configuration
claude config listList all settings
claude config set KEY VALUESet a configuration value
claude config get KEYGet a configuration value

Common Config Keys

# Set auto-update channel
claude config set autoUpdatesChannel stable

# Set allowed tools
claude config set allowedTools "read,write,search,execute"

# Set default model
claude config set model claude-sonnet-4-20250514

Interactive Session Slash Commands

Use these commands during an active Claude Code session:

CommandDescription
/helpShow all available commands
/configOpen session configuration
/costShow token usage and estimated cost
/clearClear conversation history
/compactCompress conversation to save tokens
/doctorRun health diagnostics
/loginSwitch authentication accounts
/logoutLog out of current account
/permissionsView and manage tool permissions
/reviewRequest a code review
/terminal-setupConfigure terminal integration

Piping & One-Shot Mode

Pipe Input

# Pipe file content to Claude Code
cat error.log | claude --print "Explain this error"

# Pipe command output
npm test 2>&1 | claude --print "Fix the failing tests"

One-Shot Queries

# Quick question without interactive mode
claude --print "How do I create a React context?"

# Generate code and pipe to file
claude --print "Write a Python script to parse CSV files" > parse_csv.py

Environment Variables

VariableDescription
ANTHROPIC_API_KEYAPI key for console authentication
CLAUDE_CODE_GIT_BASH_PATHPath to Git Bash on Windows
DISABLE_AUTOUPDATERSet to 1 to disable auto-updates
USE_BUILTIN_RIPGREPSet to 0 on Alpine/musl systems
CLAUDE_CODE_MAX_TOKENSOverride max output tokens

Keyboard Shortcuts

ShortcutAction
Ctrl+CCancel current operation
Ctrl+DExit Claude Code
Up ArrowPrevious input from history
Down ArrowNext input from history
TabAccept suggestion/autocomplete
EscCancel current input line
Ctrl+LClear screen (terminal level)

File Configuration

CLAUDE.md (Project Context)

Location: Project root

# Project Context
- Tech stack: React + TypeScript
- Use functional components
- Tests required for new features

.mcp.json (MCP Servers)

Location: Project root

{
  "mcpServers": {
    "server-name": {
      "command": "npx",
      "args": ["-y", "package-name"],
      "env": {}
    }
  }
}

settings.json (User Settings)

Location: ~/.claude/settings.json

{
  "autoUpdatesChannel": "stable",
  "theme": "dark"
}

Common Workflows

Feature Development

cd my-project
claude
> Implement user authentication with JWT tokens. 
  Include login, register, and middleware.

Bug Fixing

claude --continue
> The test suite is failing. Run npm test and fix all errors.

Code Review

claude
> Review the changes in the current git diff and suggest improvements.

Refactoring

claude
> Refactor the database module to use connection pooling 
  and add proper error handling.

Pro Tips

  1. Use --continue to resume where you left off
  2. Use /compact to save tokens on long sessions
  3. Use /cost to monitor spending
  4. Pipe errors directly to Claude Code for instant debugging
  5. Create aliases for common commands:
alias cc='claude'
alias ccc='claude --continue'
alias ccr='claude --resume'
alias ccp='claude --print'

Not working?

Check common errors and instant fixes in the Error Fix Center.

Fix Errors →