This guide documents all keyboard shortcuts, commands, and interactive features in Claude Code sessions.

General Keyboard Shortcuts

Shortcut Description Context
Ctrl+C Cancel current input or generation Standard interrupt
Ctrl+F Kill all background agents (press twice within 3 seconds to confirm) Background agent control
Ctrl+D Exit Claude Code session EOF signal
Ctrl+G Open in default text editor Edit prompt or custom response
Ctrl+L Clear terminal screen Keeps conversation history
Ctrl+O Toggle verbose output Shows detailed tool usage and execution
Ctrl+R Reverse search command history Search through previous commands interactively
Ctrl+V or Cmd+V (iTerm2) or Alt+V (Windows) Paste image from clipboard Pastes image or path to image file
Ctrl+B Background running tasks Backgrounds bash commands and agents. Tmux users press twice
Ctrl+T Toggle task list Show or hide task list in terminal status area
Left/Right arrows Cycle through dialog tabs Navigate between tabs in permission dialogs and menus
Up/Down arrows Navigate command history Recall previous inputs
Esc + Esc Rewind or summarize Restore code and/or conversation to a previous point
Shift+Tab or Alt+M (some configs) Toggle permission modes Switch between Auto-Accept Mode, Plan Mode, and normal mode
Option+P (macOS) or Alt+P (Windows/Linux) Switch model Switch models without clearing your prompt
Option+T (macOS) or Alt+T (Windows/Linux) Toggle extended thinking Enable or disable extended thinking mode. Run /terminal-setup first

Text Editing

Shortcut Description Context
Ctrl+K Delete to end of line Stores deleted text for pasting
Ctrl+U Delete entire line Stores deleted text for pasting
Ctrl+Y Paste deleted text Paste text deleted with Ctrl+K or Ctrl+U
Alt+Y (after Ctrl+Y) Cycle paste history After pasting, cycle through previously deleted text. Requires Option as Meta on macOS
Alt+B Move cursor back one word Word navigation. Requires Option as Meta on macOS
Alt+F Move cursor forward one word Word navigation. Requires Option as Meta on macOS

Theme and Display

Shortcut Description Context
Ctrl+T Toggle syntax highlighting for code blocks Only works inside the /theme picker menu. Controls whether code in Claude's responses uses syntax coloring

Syntax highlighting is only available in the native build.

Multiline Input

Enter multiple lines before submitting:

Method Shortcut Context
Quick escape \ + Enter Works in all terminals
macOS default Option+Enter Default on macOS
Shift+Enter Shift+Enter Works out of the box in iTerm2, WezTerm, Ghostty, Kitty
Control sequence Ctrl+J Line feed character for multiline
Paste mode Paste directly For code blocks, logs

Tip: Shift+Enter works without configuration in iTerm2, WezTerm, Ghostty, and Kitty. For other terminals (VS Code, Alacritty, Zed, Warp), run /terminal-setup to install the binding.

Quick Commands

Shortcut Description Notes
/ at start Command or skill See Built-in Commands and Skills
! at start Bash mode Run commands directly and add execution output to the session
@ File path mention Trigger file path autocomplete

Voice Input

Shortcut Description Notes
Hold Space Push-to-talk dictation Requires voice dictation enabled. Transcript inserts at cursor. Rebindable

Built-in Commands

Type / in Claude Code to see all available commands, or type / followed by any letters to filter. The / menu shows both built-in commands and bundled skills like /simplify.

Common Commands

Command Description
/help Show help
/model Change model with picker
/effort Set reasoning level: /effort low, /effort medium, /effort high, /effort max, /effort auto
/compact Compress context to free memory
/clear Start new session (preserves previous conversation for resume)
/resume Return to previous session
/status Show current status (model, auth, configuration)
/config Open settings editor
/terminal-setup Configure terminal for shell shortcuts
/doctor Run system diagnostics
/debug Enable debug mode
/vim Enable/disable Vim editor mode
/theme Show theme picker
/sandbox Configure sandboxing
/permissions Manage permissions
/btw Side question — quick question without conversation history
/feedback Send feedback about Claude Code
/init Initialize new project
/logout Sign out of account
/login Sign back in

See Commands Reference for the full list.

Bash Mode with ! Prefix

Run bash commands directly without Claude in between:

! npm test
! git status
! ls -la

Features:

  • Command and output added to conversation
  • Real-time progress and output
  • Supports Ctrl+B backgrounding for long-running commands
  • Does not require Claude to interpret or approve
  • Supports history-based autocomplete: type partial command and press Tab
  • Exit with Escape, Backspace, or Ctrl+U on empty prompt

File Mentions with @

Reference files directly with @:

@src/utils.ts
@docs/README.md
@package.json

Autocomplete shows available files. Claude receives the complete file contents when you mention a file.

Task List

Multi-step work is automatically tracked as a task list:

  • Press Ctrl+T to show/hide task list
  • Tasks show Pending, In Progress, Complete status
  • Ask Claude directly: "show me all tasks" or "clear all tasks"
  • Tasks persist across context compactions
  • Share task list across sessions with CLAUDE_CODE_TASK_LIST_ID=my-project claude

Vim Editor Mode

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

Mode Switching

Command Action From Mode
Esc Enter NORMAL mode INSERT
i Insert before cursor NORMAL
I Insert at beginning of line NORMAL
a Insert after cursor NORMAL
A Insert at end of line NORMAL
o Open line below NORMAL
O Open line above NORMAL
Command Action
h/j/k/l Move left/down/up/right
w Next word
e End of word
b Previous word
0 Beginning of line
$ End of line
^ First non-blank character
gg Beginning of input
G End of input
f{char} Jump to next occurrence of character
F{char} Jump to previous occurrence of character
t{char} Jump to just before next occurrence of character
T{char} Jump to just after previous occurrence of character
; Repeat last f/F/t/T motion
, Repeat last f/F/t/T motion in reverse

Editing (NORMAL Mode)

Command Action
x Delete character
dd Delete line
D Delete to end of line
dw/de/db Delete word/to end/back
cc Change line
C Change to end of line
cw/ce/cb Change word/to end/back
yy/Y Yank (copy) line
yw/ye/yb Yank word/to end/back
p Paste after cursor
P Paste before cursor
>> Indent line
<< Dedent line
J Join lines
. Repeat last change

Text Objects (NORMAL Mode)

Text objects work with operators like d, c, and y:

Command Action
iw/aw Inner/around word
iW/aW Inner/around WORD (whitespace-delimited)
i"/a" Inner/around double quotes
i'/a' Inner/around single quotes
i(/a( Inner/around parentheses
i[/a[ Inner/around brackets
i{/a{ Inner/around braces

Command History

Claude Code maintains command history for the current session:

  • Input history is stored per working directory
  • Input history resets when you run /clear to start a new session. The previous session's conversation is preserved and can be resumed.
  • Use Up/Down arrows to navigate

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
  3. Navigate matches: press Ctrl+R again to cycle through older matches
  4. Accept match:
    • Press Tab or Esc to accept and continue editing
    • Press Enter to accept and execute immediately
  5. Cancel search:
    • Press Ctrl+C to cancel and restore original input
    • Press Backspace on empty search to cancel

Side Questions with /btw

Ask a quick question without cluttering the conversation history:

/btw what was the name of that config file again?

Features:

  • Full visibility into current conversation
  • No tool access — only answers from existing context
  • Single response (no follow-up turns)
  • Low cost — reuses parent conversation prompt cache
  • Ephemeral — appears in overlay, never enters conversation history

Press Space, Enter, or Escape to dismiss and return to prompt.

Background Bash Commands

Run bash commands in the background to continue working:

! npm run build &  # or
Ctrl+B during regular bash invocation

Features:

  • Asynchronous execution with immediate return
  • Unique background task ID for tracking
  • Output buffered and retrievable
  • Auto-cleanup on exit
  • Auto-terminate if output exceeds 5GB

Disable with CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1

Prompt Suggestions

When you open a session, a grayed-out example command appears based on your git history. After Claude responds, suggestions continue to appear based on conversation history.

Usage:

  • Press Tab to accept, or press Enter to accept and submit
  • Start typing to dismiss

Disable with:

export CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false

Or in /config.

macOS Terminal Configuration

Set Option/Alt Key as Meta Key (required for Alt shortcuts):

iTerm2:

  • settings → Profiles → Keys → set Left/Right Option key to "Esc+"

Terminal.app:

  • settings → Profiles → Keyboard → check "Use Option as Meta Key"

VS Code:

  • settings → Profiles → Keys → set Left/Right Option key to "Esc+"

See Also

  • Claude Code Commands
  • Claude Code Skills
  • Claude Code Configuration