Claude Code CLI Reference

#tech#learning

CLI Commands & Flags

Session Management

CommandDescription
claude / claude "my prompt"Start a new session, optionally with an initial prompt
claude -p "my prompt"Query with prompt and quit (no ongoing session)
claude -cContinue most recent session
claude --agent DocsExplorerStart session with a custom agent

Tool Permissions

CommandDescription
claude --allowedTools "Read" "Write"Skip permission confirmation for specified tools
claude --disallowedTools "Write"Disallow certain tools from context
claude --dangerously-skip-permissions⚠️ Skip ALL permissions confirmations — use with caution
claude --permission-mode planStart in plan mode

Model & System

CommandDescription
claude --model opusSet default model for current session
claude --system-prompt "..."Replace entire default system prompt
claude --append-system-prompt "..."Append instruction to default system prompt

Remote & Other

CommandDescription
claude --remote "Add dark mode"Start a remote (web) session

Claude Code Interaction

ShortcutAction
SHIFT + ENTER / OPTION + ENTER / CTRL + JEnter new line
SHIFT + TABSwitch through different modes
CTRL + CCancel current input or generation
ESC + ESCRestore code prior to last action
OPTION + P / ALT + PSwitch model
ARROW keysCycle through options, questions, or past messages
CTRL + OToggle verbose output
CTRL + BMove task to background
CTRL + V / CMD + V / ALT + VInsert text or image

Crucial Commands

CommandDescription
/helpList available commands and get usage help
/modelChoose active model for current session
/clearClear session context window
/compactCompact and clear session context history
/configOpen interactive settings menu
/contextView statistics about current context window & usage
/usageView current usage for active plan
/initAnalyze project and create initial CLAUDE.MD file
/mcpView and manage installed MCP servers
/permissionsView and update / change permissions
/rewindRewind (undo) to earlier point (same as ESC + ESC)
/teleportResume a remote Claude Code session

Settings

{"permissions": {...}}

Manage permissions for all sessions.

{"model": "opus"}

Manage default AI model for new sessions.

{"alwaysThinkingEnabled": true}

Enable/disable advanced thinking mode.

{"hooks": []}

Manage hooks.

{"env": {"IS_DEMO": "1"}}

Environment variables applied to every session.