Claude Code Command Cheat Sheet: Terminal, Slash, and Shortcut Keys All in One

This guide explains the two command systems of Claude Code—terminal‑based "claude" commands and in‑chat "/" commands—lists the most frequently used terminal and slash commands, introduces three handy input prefixes, and provides a quick reference of essential shortcut keys.

Tech Ocean
Tech Ocean
Tech Ocean
Claude Code Command Cheat Sheet: Terminal, Slash, and Shortcut Keys All in One

Two command systems : Commands that start with claude are entered in the terminal shell and manage the session itself (start, continue, restore, upgrade). Commands that start with a slash / are entered inside the chat UI and control the current conversation. Mixing them makes the command fail.

Common terminal commands include: claude – start an interactive session. claude "改个登录页" – start a session and immediately supply the first prompt. claude -p "..." – ask a single question and exit, suitable for scripts or pipelines. claude -c – continue the most recent conversation. claude -r – restore a specific historical session. claude --model ... – launch with a specified model. claude update – upgrade to the latest version. claude mcp – configure the MCP server.

Practical example :

cat error.log | claude -p "挑出所有 ERROR 并按出现次数排序"

extracts error lines and sorts them by frequency without opening the interactive UI.

Slash commands (grouped by scenario) :

Token saving: /clear (reset context), /compact (compress conversation), /context (view token usage).

Configuration & status: /model, /effort, /config, /status, /cost, /permissions.

Memory & project: /init, /memory, /agents, /mcp.

Troubleshooting: /resume, /rewind, /export, /doctor, /help.

Advanced autonomy: /plan, /goal, /batch, /simplify, /code-review.

Background & orchestration: /background, /tasks (or /bashes), /loop, /schedule, /workflows.

UI & extensions: /theme, /fast, /skills, /hooks, /plugin.

Three high‑frequency input prefixes : ! – run a bash command and feed its output into the conversation, e.g., !git diff. @ – reference a file or directory, e.g., @src/app.js, which pulls the file into the session. # – write a line into project memory, e.g., # 这个项目用 pnpm 不用 npm, remembered for future turns.

Press Shift+Tab to cycle between interaction modes: normal (asks each step), auto‑accept (skips confirmations), and plan mode (lays out a plan before execution).

Essential shortcut keys : Esc – immediately interrupt the current operation.

Double Esc – revert or edit the previous message. Ctrl+R – reverse‑search command history. Ctrl+B – send the current long task to the background. Ctrl+L – clear the screen. Ctrl+C – interrupt the current action; with empty input, exit. Ctrl+D – exit the Claude Code session.

↑ / ↓ – navigate command history.

Conclusion : Although Claude Code defines hundreds of commands, the three rules to remember are: terminal commands start with claude, conversation commands start with /, and the quick‑input prefixes are ! @ #. Use /help to view the full command list instead of memorising everything.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

shortcut keysCLI commandscommand referenceClaude CodeAI tool
Tech Ocean
Written by

Tech Ocean

Focused on AI programming, sharing ready-to-use development efficiency solutions.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.