Session & Interface Mastery/The Three Interfaces
Intermediate10 min

CLI Mastery — Flags, Pipe Mode, and Keyboard Shortcuts

The CLI is Claude Code's most powerful interface. This is the complete reference for startup flags, pipe mode patterns, keyboard shortcuts, PowerShell support, and shell completion — everything the other interfaces don't expose.

Quick Reference

  • -p flag: non-interactive single response — the key to scripting and CI/CD
  • Pipe mode: cat file | claude -p 'analyze' — compose with any Unix tool
  • --output-format json: structured output for programmatic consumption
  • Keyboard shortcuts: Ctrl+B (background), Ctrl+G (editor), Ctrl+R (history), Esc+Esc (rewind)
  • PowerShell tool (March 2026): native Windows support, opt-in on Linux/macOS
  • Shell completion: claude completion --shell zsh
  • Auto theme (April 2026): matches your terminal's dark/light mode automatically

Key Startup Flags

Startup flags reference