The CLI Interface
Claude Code lives in your terminal. Understanding the interface is the first step to using it effectively.
Launching Claude
Section titled “Launching Claude”# Interactive mode (most common)claude
# One-shot mode (run a single prompt and exit)claude -p "explain this error log"
# Pipe input to Claudecat error.log | claude -p "what went wrong?"
# Resume your last conversationclaude --continueThe Interactive Prompt
Section titled “The Interactive Prompt”When you run claude, you get an interactive session:
> _This is where you type natural language instructions. Claude reads your message, decides what tools to use, and takes action.
Key Keyboard Shortcuts
Section titled “Key Keyboard Shortcuts”| Shortcut | Action |
|---|---|
Enter | Send message |
Shift+Enter | New line (multi-line input) |
Ctrl+C | Cancel current operation |
Ctrl+D | Exit Claude Code |
/ | Open slash command menu |
Slash Commands
Section titled “Slash Commands”Type / to see available commands:
/help— show help/clear— clear conversation history/compact— compress conversation to save context/model— switch models mid-session/cost— show token usage and cost/memory— manage Claude’s project memory
Understanding Tool Calls
Section titled “Understanding Tool Calls”When Claude works, you’ll see tool calls in your terminal:
Claude: I'll create that file for you.
📝 Write: src/index.html───────────────────────<html> <body>Hello World</body></html>───────────────────────
Allow? [y/n]Each tool call shows:
- What tool is being used (Read, Write, Edit, Bash, etc.)
- What it will do (the file path, command, etc.)
- A preview of the content or command
- A permission prompt (unless you’ve pre-approved it)
Permission Modes
Section titled “Permission Modes”Claude Code has three permission modes:
- Ask every time (default) — you approve each tool call
- Allow specific tools — pre-approve safe operations like file reads
- YOLO mode — auto-approve everything (use with caution!)
Configure permissions in ~/.claude/settings.json or per-project in .claude/settings.json.
Context Window
Section titled “Context Window”Claude has a context window limit. As your conversation grows, earlier messages get compressed. The /compact command forces this compression, which is useful when:
- You’re running low on context
- The conversation has drifted from the original topic
- You want to “reset” while keeping key information
- Use one-shot mode for quick questions:
claude -p "what does this regex do: ^[a-z]+$" - Use
--continueto pick up where you left off after closing your terminal - Watch the cost with
/cost— Opus is powerful but uses more tokens