WikiShortcuts and habits

Shortcuts and habits

Section 02 of 07Last reviewed 25 October 2026Applies to Claude Code 2.1.310

The few keys worth memorising, and three habits that remove most avoidable errors.

Keys

Keys can differ by platform and terminal, and can be rebound. The full list is in the interactive mode page and, for rebinding, keybindings.

Interactive session
KeyActionNote
EscInterrupt the current response or tool call. Work done so far is kept.On a permission prompt, Esc declines the action.
Ctrl+CInterrupt a running operation.On an idle prompt: first press clears the input, second exits.
Esc EscWith text in the prompt: clear the draft (Up recalls it). With an empty prompt: open the rewind menu.
Shift+TabCycle permission modes.Order: default (shown as Manual), acceptEdits, plan, then bypassPermissions and auto when available. On Windows, Alt+M when the runtime does not enable VT input mode.
/clearClear the context by starting a new conversation.Do this between unrelated tasks. Aliases /reset, /new.
Ctrl+DExit the session.Press twice.
Ctrl+RReverse-search the command history.
Ctrl+OToggle the transcript viewer with detailed tool usage.
Ctrl+GOpen the prompt in your default text editor.
Ctrl+BRun the current Bash command or agent in the background.
Ctrl+SStash the current prompt; press again on an empty prompt to restore it.
Alt+P / Option+PSwitch model without clearing the prompt.
!At the start of the prompt: run a shell command and add its output to the session.
@Mention a file path, with autocomplete.

The permission-mode indicator is shown while you cycle. Confirm the mode before approving anything; see permission modes by kind of work.

Multi-line input

MethodWorks
\ then EnterIn all terminals.
Ctrl+JIn any terminal, without configuration.
Shift+EnterNatively in several terminals (iTerm2, WezTerm, Ghostty, Kitty, Warp, Apple Terminal, Windows Terminal); others need setup, see terminal configuration.
PastePasting a block, such as a log, works directly.

Habit: name the file instead of describing it

A description such as “the config loader” leaves the tool to guess which file, and it may pick a plausible wrong one. A path leaves nothing to guess, costs less context, and shows up in the transcript for review. Use @ to complete the path.

RoundaboutDirect
Fix the bug where the date parser fails on empty input.In @src/parse/date.ts, parseDate("") throws. Make it return null. Do not edit anything under tests/.
Update the build config to include the new folder.Add src/plugins/ to the include list in @tsconfig.json. Change nothing else in that file.

State what must not change in the same sentence. That is the part a description cannot imply.

Habit: verify with real commands, not the report

A tool’s statement that tests pass, or that a file was changed, is a claim. Run the command yourself, in a terminal you control or with the ! prefix, and read its output.

Shell
git status --short          # what actually changed
git diff --stat             # how much, in which files
git log --oneline -5        # commits made during the session
<your test command>         # run it yourself and read the exit code
echo $?                     # 0 means success (POSIX shells)
  • Check the exit code, not only the summary line.
  • Read the diff for files you did not expect to be touched.
  • Re-run after the last edit. A run from before the final change proves nothing about it.

Habit: know which shell ran it

The shell the tool runs commands in may not be the one you are looking at. On macOS and Linux the tool loads your shell start-up file (~/.zshrc, ~/.bashrc or ~/.profile) to pick up aliases and functions. On Windows the Bash tool is available only when Git Bash is installed, and a PowerShell tool is used when it is not. Syntax that works in one ($VAR, &&, /dev/null) can fail in the other. Details: tools reference.

Run it with the ! prefix, then in your own terminal, and compare
echo "$0"                       # POSIX shells: name of the running shell
$PSVersionTable.PSVersion       # PowerShell only: version
pwd                             # directory the command ran in

Unofficial notes, not affiliated with or endorsed by Anthropic. Command names, flags and behaviour change between versions; the official documentation and the tool's own help output are authoritative.