Keyboard shortcuts

Keyboard shortcuts may vary by platform and terminal. Press ? to see available shortcuts for your environment.

General controls

ShortcutDescriptionContext
Ctrl+CCancel current input or generationStandard interrupt
Ctrl+DExit Claude Code sessionEOF signal
Ctrl+LClear terminal screenKeeps conversation history
Ctrl+OToggle verbose outputShows detailed tool usage and execution
Ctrl+RReverse search command historySearch through previous commands interactively
Ctrl+V (macOS/Linux) or Alt+V (Windows)Paste image from clipboardPastes an image or path to an image file
Up/Down arrowsNavigate command historyRecall previous inputs
Esc + EscRewind the code/conversationRestore the code and/or conversation to a previous point
TabToggle extended thinkingSwitch between Thinking on and Thinking off
Shift+Tab or Alt+M (some configurations)Toggle permission modesSwitch between Auto-Accept Mode, Plan Mode, and normal mode

Multiline input

MethodShortcutContext
Quick escape\ + EnterWorks in all terminals
macOS defaultOption+EnterDefault on macOS
Terminal setupShift+EnterAfter /terminal-setup
Control sequenceCtrl+JLine feed character for multiline
Paste modePaste directlyFor code blocks, logs
Configure your preferred line break behavior in terminal settings. Run /terminal-setup to install Shift+Enter binding for iTerm2 and VS Code terminals.

Quick commands

ShortcutDescriptionNotes
# at startMemory shortcut - add to CLAUDE.mdPrompts for file selection
/ at startSlash commandSee slash commands
! at startBash modeRun commands directly and add execution output to the session
@File path mentionTrigger file path autocomplete

Vim editor mode

Enable vim-style editing with /vim command or configure permanently via /config.

Mode switching

CommandActionFrom mode
EscEnter NORMAL modeINSERT
iInsert before cursorNORMAL
IInsert at beginning of lineNORMAL
aInsert after cursorNORMAL
AInsert at end of lineNORMAL
oOpen line belowNORMAL
OOpen line aboveNORMAL
CommandAction
h/j/k/lMove left/down/up/right
wNext word
eEnd of word
bPrevious word
0Beginning of line
$End of line
^First non-blank character
ggBeginning of input
GEnd of input

Editing (NORMAL mode)

CommandAction
xDelete character
ddDelete line
DDelete to end of line
dw/de/dbDelete word/to end/back
ccChange line
CChange to end of line
cw/ce/cbChange word/to end/back
.Repeat last change

Command history

Claude Code maintains command history for the current session:
  • History is stored per working directory
  • Cleared with /clear command
  • Use Up/Down arrows to navigate (see keyboard shortcuts above)
  • Note: History expansion (!) is disabled by default

Reverse search with Ctrl+R

Press Ctrl+R to interactively search through your command history:
  1. Start search: Press Ctrl+R to activate reverse history search
  2. Type query: Enter text to search for in previous commands - the search term will be highlighted in matching results
  3. Navigate matches: Press Ctrl+R again to cycle through older matches
  4. Accept match:
    • Press Tab or Esc to accept the current match and continue editing
    • Press Enter to accept and execute the command immediately
  5. Cancel search:
    • Press Ctrl+C to cancel and restore your original input
    • Press Backspace on empty search to cancel
The search displays matching commands with the search term highlighted, making it easy to find and reuse previous inputs.

Background bash commands

Claude Code supports running bash commands in the background, allowing you to continue working while long-running processes execute.

How backgrounding works

When Claude Code runs a command in the background, it runs the command asynchronously and immediately returns a background task ID. Claude Code can respond to new prompts while the command continues executing in the background. To run commands in the background, you can either:
  • Prompt Claude Code to run a command in the background
  • Press Ctrl+B to move a regular Bash tool invocation to the background. (Tmux users must press Ctrl+B twice due to tmux’s prefix key.)
Key features:
  • Output is buffered and Claude can retrieve it using the BashOutput tool
  • Background tasks have unique IDs for tracking and output retrieval
  • Background tasks are automatically cleaned up when Claude Code exits
Common backgrounded commands:
  • Build tools (webpack, vite, make)
  • Package managers (npm, yarn, pnpm)
  • Test runners (jest, pytest)
  • Development servers
  • Long-running processes (docker, terraform)

Bash mode with ! prefix

Run bash commands directly without going through Claude by prefixing your input with !:
! npm test
! git status
! ls -la
Bash mode:
  • Adds the command and its output to the conversation context
  • Shows real-time progress and output
  • Supports the same Ctrl+B backgrounding for long-running commands
  • Does not require Claude to interpret or approve the command
This is useful for quick shell operations while maintaining conversation context.

See also