Claude Code CLI commands. The flags worth knowing and the keyboard shortcuts

A cheat sheet of Claude Code commands for the terminal. claude, -p, -c, -r, --model, --permission-mode, claude update and claude doctor, plus the interactive keyboard shortcuts.

Part of the guideClaude Code, the complete guide. From installation to your own skills and plugins

In this article
  1. Claude Code commands in the terminal
  2. Flags worth knowing
  3. Keyboard shortcuts in a session
  4. The commands that actually save time

In short

Day to day, Claude Code needs about a dozen commands and flags and a handful of keyboard shortcuts. We put them in tables with examples and explain which ones actually save time.

The Claude Code documentation has one sentence that says a lot. claude --help does not list every flag, so a flag missing from the help does not mean it is unavailable. The full list runs to dozens of entries, mostly for scripts and administrators. This cheat sheet covers the Claude Code CLI commands you use every day. Everything was checked against the CLI reference and the interactive mode docs as of 10 November 2026.

Commands you type inside a session after a slash are covered separately in Claude Code slash commands. The whole series lives in the Claude Code guide.

Claude Code commands in the terminal

You type these in a normal terminal, before a session starts.

CommandWhat it does
claudeStarts a session in the current folder
claude "explain this project"Starts a session with a first prompt
claude -p "explain this function"Answers once and exits
claude -cContinues the most recent conversation in this folder
claude -r "name"Resumes a session by name or ID, without one it opens a picker
claude updateInstalls the newest version right away
claude install stableInstalls the stable channel or a given version number
claude doctorChecks the install and settings without starting a session
claude auth loginLogs in, with --console for a Console account
claude auth statusShows login status
claude mcpConfigures MCP servers
claude pluginManages plugins

You can also pipe a file into -p mode, for example cat logs.txt | claude -p "what is wrong here". claude -c skips sessions started with claude -p, so a scripted run will not jump in front of your last normal conversation. If you mistype a subcommand, such as claude udpate, Claude Code suggests the right one and does not start a session. MCP servers get their own article, Claude Code and MCP.

Flags worth knowing

Flags go after claude and only apply to that one session.

FlagWhat it doesExample
--modelPicks a model by alias or full nameclaude --model opus
--permission-modeSets the starting permission modeclaude --permission-mode plan
--effortSets how hard the model thinksclaude --effort high
-n, --nameNames the sessionclaude -n "csv-export"
--add-dirGives access to another folderclaude --add-dir ../api
-w, --worktreeStarts in a separate git worktreeclaude -w login-fix
--allowedToolsTools that run without asking"Bash(git diff *)" "Read"
--disallowedToolsTools that are blocked"Bash(rm *)"
--output-formatOutput format in -p mode--output-format json
--max-turnsStep limit in -p modeclaude -p --max-turns 3 "…"
--verboseShows the full turn by turn outputclaude --verbose
-v, --versionPrints the versionclaude -v

--permission-mode accepts default, acceptEdits, plan, auto, dontAsk and bypassPermissions, and you can type manual instead of default. --dangerously-skip-permissions is the same as bypassPermissions. Anthropic says plainly to use it only in a container or virtual machine. The rules themselves are in Claude Code permissions.

A session name from -n is more useful than it looks. The next day you type claude -r csv-export and you are back in that conversation instead of hunting through a list. -p mode with --output-format and --max-turns is the basis for scripts and CI, covered in Claude Code headless and CI.

Keyboard shortcuts in a session

These are the shortcuts you reach for most inside a session.

ShortcutWhat it does
EscStops Claude mid-turn, the work so far stays
Esc EscClears your draft, on an empty prompt opens rewind
Shift+TabCycles permission modes
Ctrl+CInterrupts, a second press on an empty prompt exits
Ctrl+D twiceExits the session
Ctrl+OShows tool call details
Ctrl+RSearches command history
Ctrl+GOpens your prompt in a text editor
Ctrl+BSends a running command to the background
Ctrl+TShows Claude's task list
Ctrl+LRedraws the screen when it gets garbled
Ctrl+V, on Windows Alt+VPastes an image from the clipboard
Option+P or Alt+PSwitches model without clearing the prompt

For a new line in your prompt, \ followed by Enter works in any terminal, and so does Ctrl+J. Shift+Enter works out of the box in iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal and Windows Terminal. On a Mac, shortcuts with Option need Option set as the Meta key, which /terminal-setup does for you.

Four characters at the start of the prompt change what your input means. / opens the list of commands and skills. ! runs a shell command without going through Claude, and the output lands in the conversation, for example ! npm test. @ autocompletes file paths. ? on an empty prompt shows the shortcut help.

The commands that actually save time

In our daily work in Claude Code, three things pay off most. First, named sessions and claude -r, because getting back into a thread after a break takes seconds. Second, Esc instead of waiting. When you see Claude heading the wrong way, you stop it and redirect, and the work so far stays. Third, ! for short commands. Test output lands in the conversation and Claude comments on it straight away.

If you are just starting, read about first run and login first.

To begin with, remember claude -c, claude -r, Esc and Shift+Tab, and come back to these tables for the rest when you need it. If you are wondering where AI could help your business beyond programming, our free AI audit is a good place to start.

What would you like to change in your business?

Leave your number. We will talk about your process and see whether we can help. The first call is free.

When is the best time to call?
Controller: Oleksandr Bondarenko (BondSoft)Privacy PolicyTerms of Service
Legal details

The data controller is Oleksandr Bondarenko, trading as Oleksandr Bondarenko Software Solutions (BondSoft), ul. Jana Heweliusza 11, 80-890 Gdańsk, Poland, NIP 5833576264, e-mail: office@bondsoft.pl.

We process your data solely to contact you about your enquiry and to present an offer — on the basis of your consent (Art. 6(1)(a) GDPR and Art. 398 of the Polish Electronic Communications Law) and our legitimate interest in handling the enquiry (Art. 6(1)(f) GDPR).

Providing the data is voluntary but necessary for us to reply. You may withdraw your consent at any time by writing to office@bondsoft.pl — this does not affect the lawfulness of processing before the withdrawal.

You have the right to access your data, rectify it, erase it, restrict its processing, transfer it, and lodge a complaint with the President of the Polish Personal Data Protection Office.

Full information: Privacy Policy.

Send us an email

The service this text is about

Automation and AI / OCR

Automation of document re-typing, OCR and checking rules, and your data stays with you.