Carles Andres' avatarHomeBlogReferenceCheatsheets
All cheatsheets

Claude CLI

Complete reference for Claude Code CLI commands, flags, slash commands, and interactive keyboard shortcuts.

claudeclaude-codeclianthropickeyboard-shortcutsterminalaikeybindings
Published on 3/25/2026

Session Commands

Terminal commands for starting, resuming, and managing Claude Code sessions.

KeyActionDetailsSource
claude
Start an interactive session in the current directory.
-
claude "query"
Start an interactive session with an initial prompt pre-filled.
-
claude -p "query"
Run a single query in print mode and exit (non-interactive). Alias: --print.
claude -c
Continue the most recent conversation in the current directory. Alias: --continue.
-
claude -r "name"
Resume a specific session by name or ID. Shows an interactive picker if no argument given. Alias: --resume.
-
claude -n "name"
Start a session with a display name (shown in /resume and terminal title). Alias: --name.
-
claude update
Update Claude Code to the latest version.
-
claude auth login
Sign in to your Anthropic account. Use --console for API key billing.
-
claude auth status
Show authentication status. Exits with code 0 if logged in, 1 if not.
-
claude agents
List all configured subagents, grouped by source (built-in, user, project, plugin).
-
claude mcp
Configure Model Context Protocol (MCP) servers.
-

CLI Flags

Command-line flags to customize behavior, permissions, and output when launching Claude Code.

KeyActionDetailsSource
--model sonnet
Set the model for the session. Accepts alias (sonnet, opus) or full model ID.
-
--permission-mode plan
Start in a specific permission mode: default, acceptEdits, plan, or bypassPermissions.
-
--effort high
Set effort level for the session: low, medium, high, or max (Opus only).
--add-dir ../lib
Add an additional working directory for Claude to access in this session.
-
--allowedTools "Read" "Bash(git *)"
Tools that execute without prompting for permission. Supports glob patterns.
-
--disallowedTools "Bash(rm *)"
Tools that are completely removed from the model's context and cannot be used.
-
--output-format json
Output format for print mode: text, json, or stream-json.
-
--bare
Minimal mode: skip hooks, skills, plugins, MCP, and CLAUDE.md for faster scripted calls.
-
--max-turns 3
Limit the number of agentic turns in print mode. Exits with error when limit reached.
-
--max-budget-usd 5.00
Maximum dollar amount to spend on API calls before stopping (print mode only).
-
--append-system-prompt "text"
Append custom instructions to the default system prompt without replacing it.
-
--verbose
Enable verbose logging, showing full turn-by-turn tool output.
-
--dangerously-skip-permissions
Skip all permission prompts. Use with caution in trusted, isolated environments only.
-
--debug "api,mcp"
Enable debug mode with optional category filtering (e.g. api, hooks, mcp).
-

Slash Commands

In-session commands typed at the prompt. Type / to see the full list and filter by name.

KeyActionDetailsSource
/help
Show all available commands and skills.
-
/clear
Clear conversation history and free up context. Aliases: /reset, /new.
-
/compact [instructions]
Compact the conversation to reduce context usage, with optional focus instructions.
-
/init
Initialize the project with a CLAUDE.md memory file.
-
/memory
Edit CLAUDE.md memory files, toggle auto-memory, and view auto-memory entries.
-
/config
Open the Settings interface to adjust theme, model, output style, and preferences. Alias: /settings.
-
/plan
Enter plan mode directly from the prompt (read-only analysis, no file edits).
-
/vim
Toggle between Vim and Normal editing modes for the input field.
-
/model [model]
Select or change the AI model mid-session. Takes effect immediately.
-
/effort [low|medium|high|max]
Set the model effort level. low/medium/high persist; max applies to current session only.
-
/cost
Show token usage and cost statistics for the current session.
-
/diff
Open an interactive diff viewer showing uncommitted changes and per-turn diffs.
-
/doctor
Diagnose and verify your Claude Code installation and settings.
-
/resume [session]
Resume a conversation by ID or name, or open the session picker. Alias: /continue.
-
/rewind
Rewind the conversation and/or code to a previous checkpoint. Alias: /checkpoint.
-
/keybindings
Open or create your keybindings configuration file at ~/.claude/keybindings.json.
-
/btw <question>
Ask a quick side question without adding it to the conversation history.
/export [filename]
Export the current conversation as plain text to a file or clipboard.
-
/permissions
View or update tool permissions interactively. Alias: /allowed-tools.
-
/mcp
Manage MCP server connections and OAuth authentication.
-

Interactive Keyboard Shortcuts

Default shortcuts during an interactive Claude Code session. Press ? to see shortcuts for your environment.

KeyActionDetailsSource
Shift+Tab
Cycle permission modes: default → acceptEdits → plan → auto (if enabled).
Ctrl+C
Cancel current input or interrupt a running generation. Cannot be rebound.
-
Ctrl+D
Exit the Claude Code session (EOF signal). Cannot be rebound.
-
Esc Esc
Rewind: restore code and/or conversation to a previous checkpoint, or summarize from a message.
-
Ctrl+G
Open the current prompt in your default text editor for longer edits.
-
Ctrl+R
Reverse-search through command history interactively.
-
Ctrl+B
Background the current bash command or agent so you can continue working. Tmux users press twice.
-
Ctrl+F
Kill all background agents. Press twice within 3 seconds to confirm.
-
Ctrl+O
Toggle verbose output to show detailed tool usage and MCP call expansions.
-
Ctrl+T
Toggle the task list view in the terminal status area.
-
Option+P (macOS) / Alt+P
Switch models without clearing your current prompt.
-
Option+T (macOS) / Alt+T
Toggle extended thinking mode. Run /terminal-setup first to enable this shortcut.
-
Up/Down arrows
Navigate through command history to recall previous inputs.
-
Left/Right arrows
Cycle through tabs in permission dialogs and menus.
-

Text Editing Shortcuts

Readline-style shortcuts for editing text in the Claude Code prompt input.

KeyActionDetailsSource
Ctrl+K
Delete text from cursor to end of line. Stores deleted text for pasting.
-
Ctrl+U
Delete the entire line. Stores deleted text for pasting.
-
Ctrl+Y
Paste text most recently deleted with Ctrl+K or Ctrl+U.
-
Alt+Y (after Ctrl+Y)
Cycle through paste history after an initial Ctrl+Y paste.
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.
-
Ctrl+L
Clear the terminal screen while keeping conversation history intact.
-
Ctrl+V / Cmd+V
Paste an image from clipboard or a path to an image file into the session.
-

Input Modes and Prefixes

Special input methods for multiline text, file references, shell commands, and voice input.

KeyActionDetailsSource
\ + Enter
Insert a newline for multiline input. Works in all terminals.
-
Option+Enter (macOS)
Insert a newline for multiline input. Default on macOS.
-
Shift+Enter
Insert a newline. Works natively in iTerm2, WezTerm, Ghostty, Kitty. Run /terminal-setup for others.
-
@ at prompt
Trigger file path autocomplete to mention and add a file to the conversation context.
-
! at prompt
Run a bash command directly; output is added to the conversation context.
/ at prompt
Open the command picker. Type letters after / to filter built-in commands and skills.
-
Hold Space
Push-to-talk voice dictation. Transcript inserts at cursor position.
Tab
Accept the current prompt suggestion or autocomplete entry.
-