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
| Command | Description |
|---|---|
claude | Start a new interactive session |
claude --continue | Continue the last conversation |
claude --resume | Resume a previous session (interactive picker) |
claude --print "query" | One-shot mode — print answer and exit |
claude --dangerously-skip-permissions | Skip permission prompts (use with caution) |
Installation & Updates
| Command | Description |
|---|---|
claude --version | Display current version |
claude doctor | Run health diagnostics |
claude update | Update to latest version |
claude install | Migrate npm install to native |
Configuration
| Command | Description |
|---|---|
claude config | Open configuration |
claude config list | List all settings |
claude config set KEY VALUE | Set a configuration value |
claude config get KEY | Get 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:
| Command | Description |
|---|---|
/help | Show all available commands |
/config | Open session configuration |
/cost | Show token usage and estimated cost |
/clear | Clear conversation history |
/compact | Compress conversation to save tokens |
/doctor | Run health diagnostics |
/login | Switch authentication accounts |
/logout | Log out of current account |
/permissions | View and manage tool permissions |
/review | Request a code review |
/terminal-setup | Configure 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
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY | API key for console authentication |
CLAUDE_CODE_GIT_BASH_PATH | Path to Git Bash on Windows |
DISABLE_AUTOUPDATER | Set to 1 to disable auto-updates |
USE_BUILTIN_RIPGREP | Set to 0 on Alpine/musl systems |
CLAUDE_CODE_MAX_TOKENS | Override max output tokens |
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Ctrl+C | Cancel current operation |
Ctrl+D | Exit Claude Code |
Up Arrow | Previous input from history |
Down Arrow | Next input from history |
Tab | Accept suggestion/autocomplete |
Esc | Cancel current input line |
Ctrl+L | Clear 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
- Use
--continueto resume where you left off - Use
/compactto save tokens on long sessions - Use
/costto monitor spending - Pipe errors directly to Claude Code for instant debugging
- Create aliases for common commands:
alias cc='claude'
alias ccc='claude --continue'
alias ccr='claude --resume'
alias ccp='claude --print'
Related Resources
- Install Claude Code — Setup guide
- Tips and Tricks — Power user techniques
- Claude Code for Beginners — Getting started
- Official Documentation — Anthropic docs