Claude Code Operation Guide |
\n\nClaude Codeβs input box is not a pure chat interface, but rather:
\n\n\n\n\nAI + Editor + Command Scheduler β Integrated Terminal
\n
There are primarily three types of prefix triggers:
\n\n| Symbol | \nType | \nEssential Function | \n
|---|---|---|
| / | \nCommand | \nExecute built-in operations | \n
| @ | \nContext | \nReference files/code/directories | \n
| ! | \nBash Mode | \nExecute terminal commands directly; stdout/stderr are automatically injected into context | \n
| # | \nMemory | \nPersistently write content into the project memory file CLAUDE.md for long-term, cross-session effect (e.g., #config.yaml) | \n
| & | \nAsync | \nExecute tasks asynchronously in the background/cloud, non-blocking the current session; view progress at claude.ai/code after closing the terminal | \n
| + Enter | \nMultiline | \nInsert line breaks without sending; write multiline content in one go for lengthy instructions | \n
| No prefix | \nNatural Language | \nStandard task instructions | \n
\n\n
/ β Operational Commands (Most Important)
\n\n/ is the core symbol in Claude Code for triggering built-in commands/tools, similar to command prefixes in a terminal shell, used to instruct Claude to perform specific operations rather than merely generating text.
\n\nCore Use Cases: Invoke built-in features (e.g., code generation, file operations, environment execution, plugin invocation, etc.).
\n\nAfter /, immediately follow with a command keyword, then a space and parameters (e.g., filenames, commands to execute, targets for fixes, etc.). This is the key mechanism Claude Code uses to distinguish natural language conversation from code operation instructions.
\n\nTyping / will display a list of available commands:
\n\nCommon frequently used commands:
\n\n| Command | \nFunction | \n
|---|---|
| /help | \nView all capabilities | \n
| /clear | \nClear conversation | \n
| /plan | \nEnter planning mode | \n
| /model | \nSwitch model | \n
| /context | \nView context usage | \n
| /export | \nExport conversation | \n
| /status | \nEnvironment status | \n
| /tasks | \nManage background tasks | \n
| /theme | \nSwitch theme | \n
| /memory | \nEdit CLAUDE.md | \n
Example:
\n\n//plan Implement a user login module\n\n\n\n\n
@ β Context Injection
\n\nAfter @, follow with a filename; Claude will auto-suggest:
\n\nReference a single file:
\n\n@main.py Help me check for bugs
\n
Reference multiple files:
\n\n@main.py @main2.py Do these two contain duplicate logic?
Reference an entire directory using @ + directory path:
@src/ Analyze project structure and provide optimization suggestions
Reference error logs:
\n\n@npm-debug.log Identify the cause of failure
Claude will load the file contents into its reasoning context.
\n\n\n\n
! β Bash Commands
\n\nRun bash commands directly by prefixing input with !, bypassing Claude. Format:
! + Bash Command
Typing ! will prompt entry into Bash command mode:
Example: view current directory:
\n\n! ls -la
\n
\n\n
Vim Editor Mode
\n\nEnable Vim-style editing using the /vim command, or configure permanently via /config.
Mode Switching
\n\n| Command | \nAction | \nFrom Mode | \n
|---|---|---|
| Esc | \nEnter NORMAL mode | \nINSERT | \n
| i | \nInsert before cursor | \nNORMAL | \n
| I | \nInsert at beginning of line | \nNORMAL | \n
| a | \nInsert after cursor | \nNORMAL | \n
| A | \nInsert at end of line | \nNORMAL | \n
| o | \nOpen new line below | \nNORMAL | \n
| O | \nOpen new line above | \nNORMAL | \n
Navigation (NORMAL Mode)
\n\n| Command | \nAction | \n
|---|---|
| h/j/k/l | \nMove left/down/up/right | \n
| w | \nNext word | \n
| e | \nEnd of word | \n
| b | \nPrevious word | \n
| 0 | \nBeginning of line | \n
| $ | \nEnd of line | \n
| ^ | \nFirst non-whitespace character | \n
| gg | \nStart of input | \n
| G | \nEnd of input | \n
| f{char} | \nJump to next occurrence of char | \n
| F{char} | \nJump to previous occurrence of char | \n
| t{char} | \nJump to just before next occurrence of char | \n
| T{char} | \nJump to just after previous occurrence of char | \n
| ; | \nRepeat last f/F/t/T motion | \n
| , | \nReverse repeat last f/F/t/T motion | \n
Editing (NORMAL Mode)
\n\n| Command | \nAction | \n
|---|---|
| x | \nDelete character | \n
| dd | \nDelete line | \n
| D | \nDelete to end of line | \n
| dw/de/db | \nDelete word/to end/backward | \n
| cc | \nChange line | \n
| C | \nChange to end of line | \n
| cw/ce/cb | \nChange word/to end/backward | \n
| yy/Y | \nYank (copy) line | \n
| yw/ye/yb | \nYank word/to end/backward | \n
| p | \nPaste after cursor | \n
| P | \nPaste before cursor | \n
| >> | \nIndent line | \n
| << | \nUnindent line | \n
| J | \nJoin lines | \n
| . | \nRepeat last change | \n
Text Objects (NORMAL Mode)
\n\nText objects work with operators like d, c, and y:
| Command | \nAction | \n
|---|---|
| iw/aw | \nInner/around word | \n
| iW/aW | \nInner/around WORD (space-delimited) | \n
| i"/a" | \nInner/around double quotes | \n
| i'/a' | \nInner/around single quotes | \n
| i(/a( | \nInner/around parentheses | \n
| i[/a[ | \nInner/around brackets | \n
| i{/a{ | \nInner/around braces | \n
\n\n
Command History
\n\nClaude Code maintains command history for the current session:
\n\n- \n
- History is stored per working directory \n
- Clear using the
/clearcommand \n - Navigate using Up/Down arrows (see keyboard shortcuts above) \n
- Note: History expansion (
!) is disabled by default \n
Reverse Search with Ctrl+R
\n\nPress Ctrl+R to interactively search your command history:
- \n
- Start search: Press
Ctrl+Rto activate reverse history search \n - Type query: Enter text to search in previous commands β matched terms are highlighted \n
- Navigate matches: Press
Ctrl+Ragain to cycle through older matches \n - Accept match:\n
- \n
- Press
TaborEscto accept current match and continue editing \n - Press
Enterto accept and immediately execute the command \n
\n - Press
- Cancel search:\n
- \n
- Press
Ctrl+Cto cancel and restore original input \n - Press
Backspaceon an empty search to cancel \n
\n - Press
The search displays matching commands with the search term highlighted, making it easy to find and reuse previous inputs.
\n\n\n\n
Background Bash Commands
\n\nClaude Code supports running bash commands in the background, allowing you to continue working while long-running processes execute.
\n\nHow Background Execution Works
\n\nWhen Claude Code runs a command in the background, it executes the command asynchronously and immediately returns a background task ID. Claude Code can respond to new prompts while the command continues running in the background.
\n\nTo run a command in the background, you can:
\n\n- \n
- Ask Claude Code to run the command in the background \n
- Press
Ctrl+Bto move a regular Bash tool call to the background. (Tmux users must pressCtrl+Btwice, as it is tmuxβs prefix key.) \n
Key Features:
\n\n- \n
- Output is buffered; Claude can retrieve it using the TaskOutput tool \n
- Background tasks have unique IDs for tracking and output retrieval \n
- Background tasks are automatically cleaned up when Claude Code exits \n
To disable all background task features, set the environment variable CLAUDE_CODE_DISABLE_BACKGROUND_TASKS to 1.
Common background commands:
\n\n- \n
- Build tools (webpack, vite, make) \n
- Package managers (npm, yarn, pnpm) \n
- Test runners (jest, pytest) \n
- Development servers \n
- Long-running processes (docker, terraform) \n
Bash Mode with ! Prefix
\n\nRun bash commands directly by prefixing input with !, bypassing Claude:
! npm test\n! git status\n! ls -la\n\n\nBash mode:
\n\n- \n
- Adds the command and its output to the conversation context \n
- Shows real-time progress and output \n
- Supports the same
Ctrl+Bfor background execution of long-running commands \n - Does not require Claude to interpret or approve the command \n
- Supports history-based autocompletion: type a partial command and press Tab to complete from previous
!commands in the current project \n
This is useful for quick shell operations while maintaining conversation context.
\n\n\n\n
Keyboard Shortcuts
\n\nGeneral Controls
\n\n| Shortcut | \nDescription | \nContext | \n
|---|---|---|
| Ctrl+C | \nCancel current input or generation | \nStandard interrupt | \n
| Ctrl+D | \nExit Claude Code session | \nEOF signal | \n
| Ctrl+G | \nOpen in default text editor | \nEdit your prompt or custom response in the default text editor | \n
| Ctrl+L | \nClear terminal screen | \nPreserve conversation history | \n
| Ctrl+O | \nToggle verbose output | \nShow detailed tool usage and execution | \n
| Ctrl+R | \nReverse search command history | \nInteractive search of previous commands | \n
| Ctrl+V or Cmd+V (iTerm2) or Alt+V (Windows) | \nPaste image from clipboard | \nPaste image or path to image file | \n
| Ctrl+B | \nRun task in background | \nRun bash commands and agents in background. Tmux users press twice | \n
| Left/Right arrows | \nCycle through conversation tabs | \nNavigate between tabs in permission dialog and menus | \n
| Up/Down arrows | \nNavigate command history | \nRecall previous inputs | \n
| Esc + Esc | \nRevert code/conversation | \nRestore code and/or conversation to previous state | \n
| Shift+Tab or Alt+M (some configs) | \nToggle permission mode | \nSwitch between auto-accept, Plan Mode, and normal mode | \n
| Option+P (macOS) or Alt+P (Windows/Linux) | \nToggle model | \nSwitch models without clearing prompt | \n
| Option+T (macOS) or Alt+T (Windows/Linux) | \nToggle extended thinking | \nEnable or disable extended thinking mode. Run /terminal-setup first to enable this shortcut | \n
Text Editing
\n\n| Shortcut | \nDescription | \nContext | \n
|---|---|---|
| Ctrl+K | \nDelete to end of line | \nStore deleted text for pasting | \n
| Ctrl+U | \nDelete entire line | \nStore deleted text for pasting | \n
| Ctrl+Y | \nPaste deleted text | \nPaste text deleted with Ctrl+K or Ctrl+U | \n
Alt+Y (after Ctrl+Y) | \n Cycle through paste history | \nCycle through previously deleted text after pasting. Requires setting Option as Meta on macOS | \n
| Alt+B | \nMove cursor backward one word | \nWord navigation. Requires setting Option as Meta on macOS | \n
| Alt+F | \nMove cursor forward one word | \nWord navigation. Requires setting Option as Meta on macOS | \n
Theme and Display
\n\n| Shortcut | \nDescription | \nContext | \n
|---|---|---|
| Ctrl+T | \nToggle syntax highlighting in code blocks | \nOnly works inside the /theme selector menu. Controls whether code in Claudeβs responses uses syntax coloring | \n
Syntax highlighting is only available in native builds of Claude Code.
\n\nMultiline Input
\n\n| Method | \nShortcut | \nContext | \n
|---|---|---|
| Quick escape | \n+ Enter | \nWorks in all terminals | \n
| macOS default | \nOption+Enter | \nDefault on macOS | \n
| Shift+Enter | \nShift+Enter | \nOut of the box in iTerm2, WezTerm, Ghostty, Kitty | \n
| Control sequence | \nCtrl+J | \nLine break for multiline input | \n
| Paste mode | \nPaste directly | \nFor code blocks, logs | \n
Shift+Enter works out of the box in iTerm2, WezTerm, Ghostty, and Kitty. For other terminals (VS Code, Alacritty, Zed, Warp), run /terminal-setup to install bindings.
YouTip