Skip to content
ARTICLES
MenuClose
Claude

Claude Code commands cheatsheet (2026)

AUTHOR
Bartłomiej Krupa
PUBLISHED
2026.07.08
UPDATED
2026.07.08
READ_TIME
8 min

The basics worth memorizing: shortcuts, prefixes, in-session slash commands, and shell CLI - not the full /commands list, just what you reach for daily. Keyboard shortcuts are described in prose, not boxed in code; the collapsible “Example” blocks only show up where there’s an actual string worth copy-pasting.

If you want the full control surface, see Claude Code tools and Claude Code plan mode for the workflow mechanics that make these shortcuts pay off. For why /compact and /clear beat buying a bigger window, see Prune the log, not the window.

Cheatsheet layout

Jump to a section:

Command cheatsheet (when you’re stuck)

Ctrl+C

  • Interrupts a running operation.
  • If nothing is running: first press clears input, second press exits.

Esc

  • Interrupts Claude mid-response / mid-tool-call so you can redirect.
  • If a dialog is open (permissions / menus), Esc closes the dialog instead.

Esc then Esc

  • If there’s text in the input: clears the draft (it’s saved; press Up to bring it back).
  • If the input is empty: opens the rewind menu.

Ctrl+R

Reverse-search your input history.

Shortcuts & prefixes

Slash commands: /…

Start your input with / to run a command (or invoke a skill).


Shell mode: !…

Prefix with ! to run a shell command; its output is added to the session.

Example
!git status

Multiline input: \\ + Enter

Works everywhere. It’s the portable “new line”.

Example
First line\
Second line

File mentions: @

Type @ for path autocomplete and file mentions.

Example
read @src/content/articles/claude-code-tools.md and summarize the key rules

Permission modes: Shift+Tab

Cycle permission modes (default - manual approval, acceptEdits, plan, plus any enabled extras).

Claude (shell) commands

These run in your normal terminal. They control how a session starts.

claude

Starts an interactive session.


claude "query"

Starts interactive mode with an initial prompt.

Example
claude "explain what this repo does and where the entrypoints are"

claude -p "query"

Print mode: runs non-interactively, then exits.

Example
claude -p "summarize the last 20 lines of this log" --output-format text

claude -c

Continues the most recent conversation in the current directory.


claude --add-dir ../path

Grants file access to additional directories.

Example
claude --add-dir ../shared

Claude commands (inside a session)

The official list is huge. These are the daily drivers.

/help

Shows help and available commands.


/usage (aliases: /cost, /stats)

Shows usage/cost and activity stats (and, on paid plans, breakdowns by skills/tools/plugins/MCP).


/export [filename]

Exports the current conversation as plain text.

Example
/export notes.txt

/clear (aliases: /reset, /new)

Starts a new conversation with empty context; the previous one stays available in /resume.

Example
/clear "before-refactor"

/exit (alias: /quit)

Exits the CLI.


/status

Opens the Status tab in Settings (version, model, account, connectivity).


/rewind (aliases: /checkpoint, /undo)

Rewinds code and/or conversation to a previous point, or summarizes from a selected message.


/plan [description]

Enters plan mode (optionally with a task description).

Example
/plan refactor src/lib/ without changing behavior

/doctor

Diagnoses and verifies your Claude Code installation and settings (and can offer to fix issues).

Session commands

/context

Shows context usage as a colored grid.


/compact [instructions]

Summarizes the conversation to free context window space.

Example
/compact keep only decisions, file paths, and open questions

/init

Initializes a repo with a starter CLAUDE.md.


/memory

Edits/views CLAUDE.md memory files and auto-memory entries.


/config (alias: /settings)

Opens settings (or sets keys via key=value).

Example
/config theme=dark

/permissions (alias: /allowed-tools)

Manages allow/ask/deny rules for tool permissions.

Context & memory

/hooks

Shows hook configurations for tool events.


/mcp

Manages MCP server connections and authentication.


/agents

Shows guidance for managing subagents (behavior depends on Claude Code version).

Bottom line

If you only memorize a few: Esc interrupts, Esc Esc rewinds, /export saves, /rewind restores, /context tells you what’s filling the window.

FAQ

How do I stop Claude mid-response without losing progress?
Press `Esc`. It interrupts the current response or tool call and keeps the work done so far, so you can redirect. If a dialog is open, `Esc` closes the dialog instead.
What’s the fastest way to undo a bad turn?
Use `/rewind` (aliases: `/checkpoint`, `/undo`) to restore code, conversation, or both back to a selected point - or to summarize part of the conversation to free context. With an empty input, `Esc` then `Esc` opens the rewind menu.
How do I run Claude Code from scripts?
Use print mode: `claude -p "summarize the last 20 lines of this log" --output-format text` runs non-interactively and exits. Add `--output-format json` when a script needs structured output, and combine with other CLI flags (`--add-dir`, `-c`) the same way you would in an interactive session.
How do I run a shell command without leaving the session?
Prefix with `!` - e.g. `!git status`. The command runs in your shell and its output is added to the conversation.
How do I point Claude at a specific file?
Type `@` for path autocomplete - e.g. `read @src/content/articles/claude-code-tools.md and summarize the key rules`.
How do I free context when the window is getting full?
Run `/compact` with optional instructions - e.g. `/compact keep only decisions, file paths, and open questions`. To see what's using space first, run `/context`. For the agent-side version of the same idea (mask older tool output instead of growing the window), see the context-management article linked in the body.
How do I start a fresh conversation without losing the old one?
Use `/clear` (aliases: `/reset`, `/new`) - e.g. `/clear "before-refactor"`. The previous conversation stays available via `/resume`; `/clear` resets the window, it does not delete the saved session.
How do I pick up where I left off?
From the project directory, run `claude -c` to continue the most recent conversation. Use `claude --resume` (or `/resume` inside a session) when you need to pick a specific older thread instead of the latest one.
How do I switch to plan mode mid-session?
Press `Shift+Tab` to cycle permission modes, or run `/plan` with an optional task - e.g. `/plan refactor src/lib/ without changing behavior`.
How do I export the current conversation?
Run `/export` with an optional filename - e.g. `/export notes.txt` saves the thread as plain text.
How do I type multiline prompts?
End a line with `\` then press `Enter` - e.g. `First line\` on one line, then `Second line` on the next. Works everywhere in the input.
How do I grant Claude access to another directory?
Start the session with `claude --add-dir ../shared` to grant file access beyond the current working directory.