Keyboard shortcuts

General controls

ShortcutDescriptionContext
Ctrl+CCancel current input or generationStandard interrupt
Ctrl+DExit Claude Code sessionEOF signal
Ctrl+LClear terminal screenKeeps conversation history
Up/Down arrowsNavigate command historyRecall previous inputs
Esc + EscEdit previous messageDouble-escape to modify
Shift+TabToggle 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

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)
  • Ctrl+R: Reverse search through history (if supported by terminal)
  • Note: History expansion (!) is disabled by default

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 runs asynchronously and returns immediately with 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