perplexity-cli
🧠 A simple command-line client for the Perplexity API. Ask questions and receive answers directly from the terminal! 🚀🚀🚀
Claude Code Guide - Setup, Commands, workflows, agents, skills & tips-n-tricks go from beginner to power user!
git clone https://github.com/zebbern/claude-code-guide.gitzebbern/claude-code-guideFor reference and contributions, visit the official Claude Code documentation
| Section | Status | Other Resources |
|---|---|---|
| Getting Started | ✅ | Claude-Code Docs |
| Configuration & Environment Variables | ✅ | Claude-Code via Discord |
| Commands & Usage | ✅ | Security Agents SKILL.md |
| Interface & Input | ✅ | Let Agent Create SKILL.md |
| Advanced Features | ✅ | 954+ Agent Skills |
| Automation & Integration | ✅ | No cost ai resources |
| Help & Troubleshooting | ✅ | 250+ Mermaid templates |
| Third-Party Integrations | ✅ | Discord Communication MCP |
Fast paths: Install · Commands · Config · MCP · Agents · Troubleshoot
Enable sound alerts when claude completes the task:
claude config set --global preferredNotifChannel terminal_bell
Tip
Send claude or npx claude in terminal to start the interface
Go to Help & Troubleshooting to fix issues...
# Native Installer (preferred — no Node.js required) ⭐️ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Windows /* Via CMD (native) */ curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd /* Via Powershell */ irm https://claude.ai/install.ps1 | iex -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # macOS / Linux / WSL /* Via Terminal */ curl -fsSL https://claude.ai/install.sh | bash -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Arch /* Via Terminal */ yay -S claude-code*/ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Alternative (npm) — useful when your environment already standardizes on Node.js # Requires Node.js 18+ -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Windows /* Via CMD (npm) */ npm install -g @anthropic-ai/claude-code -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # macOS /* Via Terminal */ brew install node && npm install -g @anthropic-ai/claude-code -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Linux /* Via Terminal */ sudo apt update && sudo apt install -y nodejs npm /* Via Terminal */ npm install -g @anthropic-ai/claude-code -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # WSL/GIT /* Via Terminal */ npm install -g @anthropic-ai/claude-code -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Docker /* Windows (CMD) */ docker run -it --rm -v "%cd%:/workspace" -e ANTHROPIC_API_KEY="sk-your-key" node:20-slim bash -lc "npm i -g @anthropic-ai/claude-code && cd /workspace && claude" /* macOS/Linux (bash/zsh)*/ docker run -it --rm -v "$PWD:/workspace" -e ANTHROPIC_API_KEY="sk-your-key" node:20-slim bash -lc 'npm i -g @anthropic-ai/claude-code && cd /workspace && claude' /* No bash Fallback */ docker run -it --rm -v "$PWD:/workspace" -e ANTHROPIC_API_KEY="sk-your-key" node:20-slim sh -lc 'npm i -g @anthropic-ai/claude-code && cd /workspace && claude' --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Check if claude is installed correctly /* Linux */ which claude /* Windows */ where claude /* Universal */ claude --version -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- # Common Management /*claude config */ Configure settings /*claude mcp list */ Setup MCP servers, you can also replace "list" with add/remove /*claude agents */ Open the agent/session dashboard /*claude update */ Run a manual update check
Tip
Open Project Via Terminal Into VS Code / Cursor
Make sure you have the (Claude Code extension) installed in your VS Code / Cursor
- OS: macOS 10.15+, Ubuntu 20.04+/Debian 10+, or Windows 10/11 or WSL
- Hardware: 4GB RAM minimum 8GB+ recommended
- Software: Git 2.23+ is optional for PR/worktree workflows. Node.js 18+ is only required for npm-based installation; the native installer bundles its own runtime.
- Internet: Connection for API calls
Tip
Find API key from Anthropic Console
Do NOT commit real keys use git-ignored files, OS key stores, or secret managers
# Universal
/* Authenticate via Anthropic account */ claude auth login
/* Authenticate via Console/API billing */ claude auth login --console
/* Switch accounts inside Claude */ /login
----------------------------------------------------------------------------------------------------------------------------------
# Windows
/* Set-api-key */ set ANTHROPIC_API_KEY=sk-your-key-here-here
/* cmd-masked-check */ echo OK: %ANTHROPIC_API_KEY:~0,8%***
/* Set-persistent-key */ setx ANTHROPIC_API_KEY "sk-your-key-here-here"
/* cmd-unset-key */ set ANTHROPIC_API_KEY=
----------------------------------------------------------------------------------------------------------------------------------
# Linux
/* Set-api-key */ export ANTHROPIC_API_KEY="sk-your-key-here-here"
/* masked-check */ echo "OK: ${ANTHROPIC_API_KEY:0:8}***"
/* remove-session */ unset ANTHROPIC_API_KEY
----------------------------------------------------------------------------------------------------------------------------------
# Powershell
/* ps-session */ $env:ANTHROPIC_API_KEY = "sk-your-key-here-here"
/* ps-masked-check */ "OK: $($env:ANTHROPIC_API_KEY.Substring(0,8))***"
/* ps-persist */ [Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY","sk-your-key-here-here","User")
/* ps-rotate */ $env:ANTHROPIC_API_KEY = "sk-new-key"
/* ps-remove */ Remove-Item Env:\ANTHROPIC_API_KEY
----------------------------------------------------------------------------------------------------------------------------------
# Other...
# persist-bash/* */ echo 'export ANTHROPIC_API_KEY="sk-your-key-here-here"' >> ~/.bashrc && source ~/.bashrc
# persist-zsh /* */ echo 'export ANTHROPIC_API_KEY="sk-your-key-here-here"' >> ~/.zshrc && source ~/.zshrc
# persist-fish/* */ fish -lc 'set -Ux ANTHROPIC_API_KEY sk-your-key-here-here'
----------------------------------------------------------------------------------------------------------------------------------
You can also set any of these in settings.json under the "env" key for automatic application.
Important
Windows Users replace export with set or setx for perm
# Environment toggles (put in ~/.bashrc or ~/.zshrc) export ANTHROPIC_API_KEY="sk-your-key-here-here" # API key sent as X-Api-Key header (interactive usage: /login) export ANTHROPIC_AUTH_TOKEN="my-auth-token" # Custom Authorization header; Claude adds "Bearer " prefix automatically export ANTHROPIC_CUSTOM_HEADERS="X-Trace-Id: 12345" # Extra request headers (format: "Name: Value") export ANTHROPIC_MODEL="sonnet" # Custom model name or alias to use export ANTHROPIC_DEFAULT_SONNET_MODEL="sonnet" # Default Sonnet alias or pinned Sonnet model ID export ANTHROPIC_DEFAULT_OPUS_MODEL="opus" # Default Opus alias or pinned Opus model ID export ANTHROPIC_SMALL_FAST_MODEL="haiku-model" # Haiku-class model for background tasks (placeholder) export ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION="REGION" # Override AWS region for the small/fast model on Bedrock (placeholder) export AWS_BEARER_TOKEN_BEDROCK="bedrock_..." # Amazon Bedrock API key/token for authentication export BASH_DEFAULT_TIMEOUT_MS=60000 # Default timeout (ms) for long-running bash commands export BASH_MAX_TIMEOUT_MS=300000 # Maximum timeout (ms) allowed for long-running bash commands export BASH_MAX_OUTPUT_LENGTH=20000 # Max characters in bash outputs before middle-truncation export CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR=1 # (0 or 1) return to original project dir after each Bash command export CLAUDE_BASH_NO_LOGIN=1 # Force BashTool to skip login shell startup files export CLAUDE_CODE_API_KEY_HELPER_TTL_MS=600000 # Interval (ms) to refresh creds when using apiKeyHelper export CLAUDE_CODE_IDE_SKIP_AUTO_INSTALL=1 # (0 or 1) skip auto-installation of IDE extensions export CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096 # Max number of output tokens for most requests export CLAUDE_CODE_USE_BEDROCK=1 # (0 or 1) use Amazon Bedrock export CLAUDE_CODE_USE_VERTEX=0 # (0 or 1) use Google Vertex AI export CLAUDE_CODE_SKIP_BEDROCK_AUTH=0 # (0 or 1) skip AWS auth for Bedrock (e.g., via LLM gateway) export CLAUDE_CODE_SKIP_VERTEX_AUTH=0 # (0 or 1) skip Google auth for Vertex (e.g., via LLM gateway) export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=0 # (0 or 1) disable nonessential traffic (equivalent to DISABLE_* below) export CLAUDE_CODE_DISABLE_TERMINAL_TITLE=0 # (0 or 1) disable automatic terminal title updates export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 # (0 or 1) enable agent teams research preview export CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1 # (0 or 1) load CLAUDE.md from --add-dir paths export CLAUDE_CODE_ENABLE_TASKS=false # Set to "false" to disable the task system export DISABLE_AUTOUPDATER=0 # (0 or 1) disable automatic updates (overrides autoUpdates setting) export DISABLE_BUG_COMMAND=0 # (0 or 1) disable the /bug command export DISABLE_COST_WARNINGS=0 # (0 or 1) disable cost warning messages export DISABLE_ERROR_REPORTING=0 # (0 or 1) opt out of Sentry error reporting export DISABLE_NON_ESSENTIAL_MODEL_CALLS=0 # (0 or 1) disable model calls for non-critical paths export DISABLE_TELEMETRY=0 # (0 or 1) opt out of Statsig telemetry export HTTP_PROXY="http://proxy:8080" # HTTP proxy server URL export HTTPS_PROXY="https://proxy:8443" # HTTPS proxy server URL export MAX_THINKING_TOKENS=0 # (0 or 1 to turn off/on) force a thinking budget for the model export MCP_TIMEOUT=120000 # MCP server startup timeout (ms) export MCP_TOOL_TIMEOUT=60000 # MCP tool execution timeout (ms) export MAX_MCP_OUTPUT_TOKENS=25000 # Max tokens allowed in MCP tool responses (default 25000) export USE_BUILTIN_RIPGREP=0 # (0 or 1) set 0 to use system-installed rg instead of bundled one # Vertex AI region overrides follow VERTEX_REGION_CLAUDE_<MODEL_FAMILY>. export VERTEX_REGION_CLAUDE_3_5_HAIKU="REGION" # 3.x family example export VERTEX_REGION_CLAUDE_4_6_SONNET="REGION" # Sonnet family example export VERTEX_REGION_CLAUDE_4_8_OPUS="REGION" # Opus family example # -- Session and runtime controls --------------------------------------------- export CLAUDE_CODE_SIMPLE=1 # Minimal mode: disables MCP tools, attachments, hooks, CLAUDE.md, and skills export CLAUDE_CODE_DISABLE_1M_CONTEXT=1 # Disable 1 M-token context window (use default shorter context) export CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 # Disable background tasks entirely export CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 # Opt out of experimental beta features export CLAUDE_CODE_AUTO_CONNECT_IDE=false # Disable automatic IDE connection on startup export CLAUDE_CODE_TMPDIR="/custom/tmp" # Override the temp directory Claude Code uses export CLAUDE_CODE_SHELL="/bin/zsh" # Override shell detection (force a specific shell) export CLAUDE_CODE_SHELL_PREFIX="command-wrapper" # Prefix/wrap every shell command Claude runs export CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS=50000 # Override max output tokens for the Read tool export CLAUDE_CODE_PROXY_RESOLVES_HOSTS=true # Let the HTTP/HTTPS proxy handle DNS resolution export CLAUDE_CODE_EXIT_AFTER_STOP_DELAY=30000 # Auto-exit SDK mode after idle for N ms export CLAUDE_CODE_PLUGIN_GIT_TIMEOUT_MS=30000 # Timeout (ms) for plugin git operations export CLAUDE_CODE_ACCOUNT_UUID="uuid" # Override account UUID (SDK / automation flows) export CLAUDE_CODE_USER_EMAIL="user@example.com" # Override user email (SDK / automation flows) export CLAUDE_CODE_ORGANIZATION_UUID="uuid" # Override organization UUID (SDK / automation flows) export ENABLE_CLAUDEAI_MCP_SERVERS=false # Opt out from claude.ai-synced MCP servers export FORCE_AUTOUPDATE_PLUGINS=1 # Allow plugin auto-update even when main updater is disabled export IS_DEMO=1 # Demo mode — hides email/org from the UI export NO_PROXY="localhost,127.0.0.1" # Bypass proxy for specified hosts (comma-separated) # -- Provider, terminal, and telemetry controls -------------------------------- export CLAUDE_CODE_ENABLE_AUTO_MODE=1 # Enable auto mode on Bedrock, Vertex, and Foundry for Opus 4.7/4.8 export CLAUDE_CODE_USE_POWERSHELL_TOOL=1 # Enable PowerShell tool where available; Windows provider sessions may default to it export CLAUDE_CODE_POWERSHELL_RESPECT_EXECUTION_POLICY=1 # Opt out of PowerShell -ExecutionPolicy Bypass behavior export CLAUDE_CODE_NO_FLICKER=1 # Prefer flicker-free alternate-screen rendering where supported export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1 # Let compatible gateways populate the model picker from /v1/models export CLAUDE_CODE_FORCE_SYNC_OUTPUT=1 # Force synchronized terminal output when auto-detection misses support export CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1 # Let package-manager installs run background upgrades where supported export ENABLE_PROMPT_CACHING_1H=true # Opt in to 1-hour prompt cache TTL when your provider supports it export OTEL_LOG_TOOL_DETAILS=1 # Include tool parameters in tool_decision telemetry events export OTEL_METRICS_INCLUDE_ENTRYPOINT=true # Include session entrypoint on OpenTelemetry metrics
claude config set -g theme dark # Theme: dark | light | light-daltonized | dark-daltonized
claude config set -g preferredNotifChannel iterm2_with_bell # Notification channel: iterm2 | iterm2_with_bell | terminal_bell | notifications_disabled
claude config set -g autoUpdates true # Auto-download & install updates (applied on restart)
claude config set -g verbose true # Show full bash/command outputs
claude config set -g attribution false # Omit "co-authored-by Claude" in git commits/PRs
claude config set -g forceLoginMethod claudeai # Restrict login flow: claudeai | console
claude config set -g model "sonnet" # Default model override; use a full model ID only when pinning
claude config set -g statusLine '{"type":"command","command":"~/.claude/statusline.sh"}' # Custom status line
claude config set -g enableAllProjectMcpServers true # Auto-approve all MCP servers from .mcp.json
claude config set -g enabledMcpjsonServers '["memory","github"]' # Approve specific MCP servers
claude config set -g disabledMcpjsonServers '["filesystem"]' # Reject specific MCP servers
(Memory type) Claude Code offers four memory locations in a hierarchical structure, each serving a different purpose:
| Memory Type | Location | Purpose | Use Case Examples | Shared With |
|---|---|---|---|---|
| Enterprise policy | macOS: /Library/Application Support/ClaudeCode/CLAUDE.mdLinux: /etc/claude-code/CLAUDE.mdWindows: C:\ProgramData\ClaudeCode\CLAUDE.md |
Organization-wide instructions managed by IT/DevOps | Company coding standards, security policies, compliance requirements | All users in organization |
| Project memory | ./CLAUDE.md |
Team-shared instructions for the project | Project architecture, coding standards, common workflows | Team members via source control |
| User memory | ~/.claude/CLAUDE.md |
Personal preferences for all projects | Code styling preferences, personal tooling shortcuts | Just you (all projects) |
| Project memory (local) | ./CLAUDE.local.md |
Personal project-specific preferences (git-ignored) | Your sandbox URLs, preferred test data, personal overrides | Just you (current project) |
| Project rules | .claude/rules/*.md |
Modular project rules (loaded alongside CLAUDE.md) | Linting rules, API conventions, per-directory standards | Team members via source control |
All memory files are automatically loaded into Claude Code's context when launched. Files higher in the hierarchy take precedence and are loaded first, providing a foundation that more specific memories build upon.
.claude/rules/ DirectoryThe .claude/rules/ directory lets you break project instructions into separate Markdown files instead of one large CLAUDE.md. Every *.md file inside is automatically loaded into context alongside CLAUDE.md. This is useful for:
api-conventions.md, testing-rules.md)rules/ directories can apply scoped rulesClaude can save useful working context during your sessions, such as project conventions, tooling preferences, and architectural decisions it observes while helping you. Use /memory to inspect, edit, or remove saved memories.
Auto-memory is most useful for context you would otherwise repeat across sessions:
Keep durable team rules in CLAUDE.md or .claude/rules/. Treat auto-memory as helpful working context, not as the only source of truth.
| Command | Purpose |
|---|---|
/add-dir |
Add additional working directories |
/agents |
Manage custom AI subagents for specialized tasks |
/branch |
Branch or fork the current conversation into a separate session |
/bug |
Report bugs (sends conversation to Anthropic) |
/clear |
Clear conversation history |
/compact [instructions] |
Compact conversation with optional focus instructions |
/config |
Open the Settings interface (Config tab) |
/context |
Visualize current context usage as a colored grid |
/copy |
Copy conversation content to clipboard |
/code-review [effort] |
Run correctness-focused code review; use --fix to apply findings or --comment for PR comments |
/color |
Set or randomize the current session accent color |
/debug |
Troubleshoot current session and diagnose issues |
/doctor |
Checks the health of your Claude Code installation |
/effort |
Pick reasoning effort for the current model/session |
/exit |
Exit the REPL |
/export [filename] |
Export the current conversation to a file or clipboard |
/fast |
Toggle fast mode for accelerated Opus responses where available |
/goal |
Set a completion condition so Claude keeps working across turns until it is met |
/help |
Get usage help |
/init |
Initialize project with CLAUDE.md guide |
/insights |
Generate an interactive HTML report analyzing your coding habits |
/keybindings |
Configure custom keyboard shortcuts |
/login |
Switch Anthropic accounts |
/loop |
Schedule a recurring prompt or slash command |
/logout |
Sign out from your Anthropic account |
/mcp |
Manage MCP server connections and OAuth authentication |
/memory |
Edit CLAUDE.md memory files |
/model |
Select or change the AI model |
/permissions |
View or update tool permissions |
/plan |
Enter plan mode directly from the prompt |
/plugins |
Manage plugins (install, enable, disable, marketplace) |
/pr_comments |
View pull request comments |
/release-notes |
Open the built-in release notes view |
/rename <name> |
Rename the current session for easier identification |
/resume [session] |
Resume a conversation by ID or name, or open session picker |
/rules |
View and manage .claude/rules/ directory (modular project rules) |
/rewind |
Rewind the conversation and/or code to a previous point |
/sandbox |
View sandbox dependency status with installation instructions |
/scroll-speed |
Tune mouse wheel scroll speed with a live preview |
/settings |
Open Settings interface (alias for /config) |
/simplify |
Run cleanup-only review for reuse, simplification, efficiency, and altitude |
/status |
Open Settings interface (Status tab) showing version, model, account |
/statusline |
Set up Claude Code's status line UI |
/tasks |
List and manage background tasks |
/teleport |
Resume a remote session from claude.ai (subscribers only) |
/terminal-setup |
Install Shift+Enter key binding for newlines (iTerm2, VS Code, Kitty, Alacritty, Zed, Warp, and WezTerm) |
/remote-env |
Configure remote environment settings |
/theme |
Change the color theme |
/todos |
List current TODO items |
/ultrareview [target] |
Run comprehensive cloud code review with parallel multi-agent analysis |
/usage |
Show plan usage limits and rate limit status (subscription plans) |
/usage-credits |
Enable or inspect usage credits for higher-throughput modes |
/workflows |
View dynamic workflow runs and background orchestration status |
/batch |
Run batch operations on multiple files (bundled skill) |
| Flag / Command | Description | Example |
|---|---|---|
-d, --debug |
Enable debug mode (shows detailed debug output). | claude -d -p "query" |
--include-partial-messages |
partial message streaming support via CLI flag | claude -p "query" --include-partial-messages |
--verbose |
Override verbose mode setting from config (shows expanded logging / turn-by-turn output). | claude --verbose |
-p, --print |
Print response and exit (useful for piping output). | claude -p "query" |
--output-format <format> |
Output format (only works with --print): text (default), json (single result), or stream-json (realtime streaming). |
claude -p "query" --output-format json |
--input-format <format> |
Input format (only works with --print): text (default) or stream-json (realtime streaming input). |
claude -p --output-format stream-json --input-format stream-json |
--replay-user-messages |
Re-emit user messages from stdin back to stdout for acknowledgment — only works with --input-format=stream-json and --output-format=stream-json. |
claude --input-format stream-json --output-format stream-json --replay-user-messages |
--allowedTools, --allowed-tools <tools...> |
Comma/space-separated list of tool names to allow (e.g. "Bash(git:*) Edit"). |
--allowed-tools "Bash(git:*)" Edit" |
--disallowedTools, --disallowed-tools <tools...> |
Comma/space-separated list of tool names to deny (e.g. "Bash(git:*) Edit"). |
--disallowed-tools "Edit" |
--mcp-config <configs...> |
Load MCP servers from JSON files or strings (space-separated). | claude --mcp-config ./mcp-servers.json |
--strict-mcp-config |
Only use MCP servers from --mcp-config, ignoring other MCP configurations. |
claude --mcp-config ./a.json --strict-mcp-config |
--append-system-prompt <prompt> |
Append a system prompt to the default system prompt (useful in print mode). | claude -p --append-system-prompt "Do X then Y" |
--permission-mode <mode> |
Permission mode for the session (choices include acceptEdits, auto, bypassPermissions, default, plan). |
claude --permission-mode plan |
--permission-prompt-tool <tool> |
Specify an MCP tool to handle permission prompts in non-interactive mode. | claude -p --permission-prompt-tool mcp_auth_tool "query" |
--fallback-model <model> |
Enable automatic fallback to a specified model when the default is overloaded (note: only works with --print per help). |
claude -p --fallback-model claude-haiku-20240307 "query" |
--model <model> |
Model for the current session. Accepts aliases like sonnet/opus or a full model ID when pinning. |
claude --model sonnet |
--settings <file-or-json> |
Load additional settings from a JSON file or a JSON string. | claude --settings ./settings.json |
--add-dir <directories...> |
Additional directories to allow tool access to. | claude --add-dir ../apps ../lib |
--ide |
Automatically connect to an IDE on startup if exactly one valid IDE is available. | claude --ide |
-c, --continue |
Continue the most recent conversation in the current directory. | claude --continue |
-r, --resume [sessionId] |
Resume a conversation; provide a session ID or interactively select one. | claude -r "abc123" |
--session-id <uuid> |
Use a specific session ID for the conversation (must be a valid UUID). | claude --session-id 123e4567-e89b-12d3-a456-426614174000 |
--agents <json> |
Define custom subagents dynamically via JSON (see subagent docs for format). | claude --agents '{"reviewer":{"description":"Reviews code","prompt":"..."}}' |
--agent <name> |
Specify a specific agent for the current session. | claude --agent my-custom-agent |
--bg |
Start or continue work as a background session that can be viewed from claude agents. |
claude --bg "fix failing tests" |
--bg --exec <command> |
Run a shell command as an attachable background session. | claude --bg --exec "npm test" |
--name <label> |
Name a background or remote session for easier identification. | claude --bg --name nightly-check "run checks" |
--chrome |
Enable Chrome browser integration for web automation and testing. | claude --chrome |
--no-chrome |
Disable Chrome browser integration for this session. | claude --no-chrome |
--remote |
Create a new web session on claude.ai with the provided task description. | claude --remote "Fix the login bug" |
--teleport |
Resume a web session in your local terminal. | claude --teleport |
--fork-session |
When resuming, create a new session ID instead of reusing the original. | claude --resume abc123 --fork-session |
--json-schema <schema> |
Get validated JSON output matching a JSON Schema after agent completes (print mode only). | claude -p --json-schema '{"type":"object",...}' "query" |
--max-budget-usd <amount> |
Maximum dollar amount to spend on API calls before stopping (print mode only). | claude -p --max-budget-usd 5.00 "query" |
--max-turns <n> |
Limit the number of agentic turns (print mode only). Exits with error when limit reached. | claude -p --max-turns 3 "query" |
--betas <headers> |
Beta headers to include in API requests (API key users only). | claude --betas interleaved-thinking |
--tools <tools> |
Restrict which built-in tools Claude can use. Use "" to disable all, "default" for all, or specific tool names. | claude --tools "Bash,Edit,Read" |
--system-prompt <prompt> |
Replace the entire system prompt with custom text (works in interactive and print modes). | claude --system-prompt "You are a Python expert" |
--system-prompt-file <file> |
Load system prompt from a file, replacing the default prompt (print mode only). | claude -p --system-prompt-file ./custom-prompt.txt "query" |
--append-system-prompt-file <file> |
Load additional system prompt text from a file and append to default (print mode only). | claude -p --append-system-prompt-file ./extra-rules.txt "query" |
--plugin-dir <dir> |
Load plugins from directories for this session only (repeatable). | claude --plugin-dir ./my-plugins |
--setting-sources <sources> |
Comma-separated list of setting sources to load (user, project, local). | claude --setting-sources user,project |
--no-session-persistence |
Disable session persistence so sessions are not saved to disk (print mode only). | claude -p --no-session-persistence "query" |
--disable-slash-commands |
Disable all skills and slash commands for this session. | claude --disable-slash-commands |
--dangerously-skip-permissions |
Bypass all permission checks (only for trusted sandboxes). | claude --dangerously-skip-permissions |
--worktree, -w |
Start in an isolated git worktree; worktree.baseRef controls whether it branches from fresh remote state or local HEAD. |
claude -w "implement feature" |
--from-pr <url> |
Start a session from a pull request URL. | claude --from-pr https://github.com/org/repo/pull/123 |
--init |
Trigger the Setup hook event. | claude --init |
--init-only |
Run Setup hooks and exit. | claude --init-only |
--maintenance |
Run Setup hooks in maintenance mode. | claude --maintenance |
-v, --version |
Show the installed claude CLI version. |
claude --version |
-h, --help |
Display help / usage. | claude --help |
The
--output-format jsonflag is particularly useful for scripting and automation, allowing you to parse Claude's responses programmatically.
## Claude Cheat Sheet
# Start and resume
claude # Start interactive REPL
claude "explain this project" # Start REPL seeded with a prompt
claude -p "summarize README.md" # Non-interactive print mode (SDK-backed)
cat logs.txt | claude -p "explain" # Pipe input to Claude and exit
claude -c # Continue most recent conversation
claude -r "<session-id>" "finish this" # Resume by ID or name
claude --model sonnet # Pick the Sonnet alias for this run
claude --model opus # Pick the Opus alias for harder tasks
# Install, update, and auth
claude update # Manually update Claude Code
claude doctor # Diagnose install/version & setup
claude install # Start the native binary installer
claude migrate-installer # Switch from global npm to the native installer
claude auth login # Log in to your Anthropic account
claude auth status # Check authentication status
claude auth logout # Log out
# Background and remote sessions
claude agents # Open the live session dashboard: running, blocked, completed
claude agents --json # Scriptable JSON list of live/background sessions
claude --bg "run the integration suite and summarize failures" # Start a background session
claude --bg --exec "npm test" # Run a shell command as an attachable background session
claude remote-control # Start remote-control mode for external tooling
claude --remote "Fix the bug" # Create web session on claude.ai
claude --teleport # Resume web session locally
# Config essentials
claude config # Interactive config wizard
claude config set model "sonnet" # Override default model for this project
claude config set attribution false # Disable "co-authored-by Claude" byline in git/PRs
claude config set enableAllProjectMcpServers true # Auto-approve all MCP servers from .mcp.json
claude config set defaultMode "acceptEdits" # Set default permission mode
claude config set worktree.baseRef "head" # Use local HEAD instead of origin/default for new worktrees
claude config set -g autoUpdates false # Turn off automatic updates globally
claude config set -g theme dark # Theme: dark | light | light-daltonized | dark-daltonized
# MCP essentials
claude mcp # Launch MCP wizard / configure MCP servers
claude mcp list # List configured MCP servers
claude mcp get <name> # Show details for a server
claude mcp add <name> <command> [args...] # Add local stdio server
claude mcp add --transport http <name> <url> # Add remote HTTP server
claude mcp reset-project-choices # Reset approvals for project .mcp.json servers
claude mcp serve # Run Claude Code itself as an MCP stdio server
# High-value flags
claude --add-dir ../apps ../lib # Add additional working directories
claude --allowedTools "Bash(git log:\*)" "Read" # Allow listed tools without permission prompts
claude --disallowedTools "Edit" # Disallow listed tools without permission prompts
claude -p "query" --output-format json --input-format stream-json # Control IO formats for scripting
claude --verbose # Verbose logging (turn-by-turn)
claude --dangerously-skip-permissions # Skip permission prompts (use with caution)
claude --permission-mode plan # Start in plan mode (read-only analysis)
claude --max-turns 3 -p "query" # Limit agentic turns (print mode only)
claude --json-schema '{"type":"object"}' -p "query" # Get validated JSON output
claude --chrome # Enable Chrome browser integration
claude --agent code-reviewer # Run this session with a named agent
claude ultrareview 123 --json # Non-interactive comprehensive review for PR/target 123
# Slash shortcuts
claude --fork-session -r abc123 # Fork instead of reusing original
claude -w "implement feature" # Start in an isolated git worktree
/rename auth-refactor # Name current session
/resume # Open session picker
/export output.md # Export conversation to file
/branch experiment-name # Branch the current conversation
/goal "all tests pass and README is updated" # Keep working until the completion condition is met
/loop 30m "check deploy health and summarize anomalies" # Schedule recurring work
/workflows # View dynamic workflows and background orchestration
# Notes: project scope is default for 'claude config'; use -g/--global for user-global settings.
# Settings precedence: Enterprise > CLI args > local project > shared project > user (~/.claude).
| Shortcut | Description | Context |
|---|---|---|
Ctrl+C |
Cancel current input or generation | Standard interrupt |
Ctrl+D |
Exit Claude Code session | EOF signal |
Ctrl+G |
Open in default text editor | Edit your prompt or custom response |
Ctrl+L |
Clear terminal screen | Keeps conversation history |
Ctrl+O |
Toggle verbose output | Shows detailed tool usage and execution |
Ctrl+R |
Reverse search command history | Search through previous commands |
Ctrl+V or Cmd+V (iTerm2) |
Paste image from clipboard | Pastes an image or path to an image file |
Ctrl+B |
Background running tasks | Backgrounds bash commands and agents |
Ctrl+F (press twice) |
Kill all background agents | Two-press confirmation to stop agents |
Up/Down arrows |
Navigate command history | Recall previous inputs |
Left/Right arrows |
Cycle through dialog tabs | Navigate between tabs in dialogs |
Esc + Esc |
Rewind the code/conversation | Restore to a previous point |
Shift+Tab or Alt+M |
Toggle permission modes | Switch between Auto-Accept, Plan, Normal |
Option+P (macOS) / Alt+P |
Switch model | Switch models without clearing prompt |
Option+T (macOS) / Alt+T |
Toggle extended thinking | Enable/disable extended thinking mode |
| Shortcut | Description | Context |
|---|---|---|
Ctrl+K |
Delete to end of line | Stores deleted text for pasting |
Ctrl+U |
Delete entire line | Stores deleted text for pasting |
Ctrl+Y |
Paste deleted text | Paste text deleted with Ctrl+K/U |
Alt+Y (after Ctrl+Y) |
Cycle paste history | Cycle through previously deleted text |
Alt+B |
Move cursor back one word | Requires Option as Meta on macOS |
Alt+F |
Move cursor forward one word | Requires Option as Meta on macOS |
| Method | Shortcut | Context |
|---|---|---|
| Quick escape | \ + Enter |
Works in all terminals |
| macOS default | Option+Enter |
Default on macOS |
| Terminal setup | Shift+Enter |
After /terminal-setup |
| Control sequence | Ctrl+J |
Line feed character for multiline |
| Paste mode | Paste directly | For code blocks, logs |
| Shortcut | Description | Notes |
|---|---|---|
/ at start |
Command or skill | See built-in commands and skills |
! at start |
Bash mode | Run commands directly, add to context |
@ |
File path mention | Trigger file path autocomplete |
Tip
PDF Page Ranges: Use the pages parameter with the Read tool for PDFs (e.g., pages: "1-5"). Large PDFs (>10 pages) return a lightweight reference when @-mentioned instead of being inlined.
Note
Enable vim-style editing from /config -> Editor mode.
| Command | Action | From mode |
|---|---|---|
Esc |
Enter NORMAL mode | INSERT |
i |
Insert before cursor | NORMAL |
I |
Insert at beginning of line | NORMAL |
a |
Insert after cursor | NORMAL |
A |
Insert at end of line | NORMAL |
o |
Open line below | NORMAL |
O |
Open line above | NORMAL |
| Command | Action |
|---|---|
h/j/k/l |
Move left/down/up/right |
w |
Next word |
e |
End of word |
b |
Previous word |
0 |
Beginning of line |
$ |
End of line |
^ |
First non-blank character |
gg |
Beginning of input |
G |
End of input |
| Command | Action |
|---|---|
x |
Delete character |
dd |
Delete line |
D |
Delete to end of line |
dw/de/db |
Delete word/to end/back |
cc |
Change line |
C |
Change to end of line |
cw/ce/cb |
Change word/to end/back |
. |
Repeat last change |
Tip
Configure your preferred line break behavior in terminal settings. Run /terminal-setup to install Shift+Enter binding for iTerm2, VS Code, Kitty, Alacritty, Zed, Warp, and WezTerm.
Claude Code maintains command history for the current session:
* History is stored per working directory
* Cleared with `/clear` command
* Use Up/Down arrows to navigate (see keyboard shortcuts above)
* **Ctrl+R**: Reverse search through history (if supported by terminal)
* **Note**: History expansion (`!`) is disabled by default
Note
Gives Claude extra pre-answer planning time by adding ONE of these keywords to your prompt. Order (lowest → highest) token consumption
|
Higher levels usually increase latency and token usage pick the smallest that works.
# Small boost claude -p "Think. Outline a plan to refactor the auth module." # Medium boost claude -p "Think harder. Draft a migration plan from REST to gRPC." # Max boost claude -p "Ultrathink. Propose a step-by-step strategy to fix flaky payment tests and add guardrails."
Use /effort to tune how much reasoning the selected model applies before answering. Higher effort levels are best for planning-heavy work, deep reviews, and long-context tasks.
/effort # Open the effort picker /effort low # Faster, lighter reasoning /effort medium # Balanced default for many tasks /effort high # Deeper planning and review /effort xhigh # Highest effort for Opus 4.8-scale hard tasks
Prefer the lowest effort that still solves the task: higher effort can improve planning, code review, and long-context reasoning, but it usually increases latency and token usage.
Note
Fast Mode provides accelerated Opus responses for rapid iteration when speed matters more than maximum depth.
How to enable Fast Mode:
# Enable usage credits if your plan requires it, then toggle fast mode /usage-credits /fast # Or toggle during conversation # The status bar will show when Fast Mode is active
Key features:
/usage-credits before /fastWhen to use Fast Mode:
Fast Mode trades some depth for speed. Use normal mode for complex analysis and planning tasks.
Auto mode lets Claude evaluate and approve lower-risk actions automatically while still blocking or asking on higher-risk operations. It is useful for trusted development loops where repeated permission prompts slow down work.
# Enable auto mode for Bedrock, Vertex, and Foundry Opus 4.7/4.8 sessions export CLAUDE_CODE_ENABLE_AUTO_MODE=1
{
"autoMode": {
"allow": ["$defaults"],
"soft_deny": ["$defaults"],
"hard_deny": []
}
}
Key points:
"$defaults" in autoMode.allow, autoMode.soft_deny, or autoMode.environment to add rules without replacing built-ins.settings.autoMode.hard_deny blocks actions unconditionally regardless of user intent./permissions recent activity, where supported, so you can retry or adjust policy.Note
Plan Mode instructs Claude to analyze the codebase with read-only operations, perfect for exploring codebases, planning complex changes, or reviewing code safely.
When to use Plan Mode:
How to enable Plan Mode:
# Start a new session in Plan Mode claude --permission-mode plan # Or toggle during session with Shift+Tab # (cycles through: Normal → Auto-Accept → Plan Mode) # Enter plan mode from the prompt /plan # Run headless queries in Plan Mode claude --permission-mode plan -p "Analyze the authentication system and suggest improvements"
Configure Plan Mode as default:
// .claude/settings.json
{
"permissions": {
"defaultMode": "plan"
}
}
Note
Claude Code supports background commands and full background sessions, allowing you to continue working while long-running processes or agents execute.
How to use background tasks:
| Method | Description |
|---|---|
| Prompt Claude | Ask Claude to "run this in the background" |
Ctrl+B |
Move a running Bash tool invocation to background (tmux users press twice) |
! <command> |
In claude agents, start an attachable background shell session |
claude --bg |
Launch a task as a background Claude session |
Key features:
/resume and the claude agents dashboard, marked with bg/tasks to list and manage background tasksclaude agents --json for scripts, status bars, session pickers, and tmux integrationsmore like this
🧠 A simple command-line client for the Perplexity API. Ask questions and receive answers directly from the terminal! 🚀🚀🚀
Comprehensive analytics dashboard for AI coding agents — Cursor, Windsurf, Claude Code, VS Code Copilot, Zed, Antigravi…
Skill Claude Code de veille tech francophone. Agrège les flux RSS (Journal du Hacker, Human Coders News…) et produit un…
A to-do list that runs your Claude Code agents — capture anywhere, dispatch in parallel, review from your phone.
search projects, people, and tags