Blog

Claude Code: Commands You Didn't Know About

13 Apr 2026

Claude Code: Commands You Didn't Know About

Most developers use Claude Code the same way: type a prompt, hit Enter, approve some tool calls, repeat. That workflow gets you maybe 40% of what Claude Code can actually do.

Buried in the interface are keyboard shortcuts that save minutes per session, slash commands that solve problems you didn't know had solutions, and CLI flags that turn Claude Code into a completely different tool. This guide covers the commands and features that most users never discover.

Keyboard Shortcuts That Change How You Work

The Claude Code terminal is not a basic text input. It's a full editing environment with shortcuts that rival your code editor.

Escape Is Not Ctrl+C

The single most important shortcut to learn: Escape stops Claude's generation. Not Ctrl+C — that exits the entire session. If Claude is mid-response and you want it to stop, press Escape.

Double-tap Escape and you get something even more powerful: the rewind menu. This shows all previous checkpoints in your conversation and lets you roll back to any of them. You can rewind code changes only, conversation only, or both. You can also summarize everything from a selected point forward — a surgical way to compress context without losing early decisions.

Ctrl+S — Stash Your Prompt

You're halfway through typing a complex prompt when you realize you need to ask Claude something else first. Instead of deleting everything, press Ctrl+S. Your current input gets stashed. Type and submit your other question. Once that response comes back, the stashed prompt automatically restores in the input field.

This is the kind of feature that sounds minor until you use it once. Then you use it constantly.

Ctrl+O — The Transcript Viewer

Press Ctrl+O to toggle the transcript viewer. This shows the detailed log of every tool call, including MCP reads and searches that normally collapse to a single line like "Queried slack." In fullscreen rendering, it cycles through three views: normal prompt, transcript mode, and focus view (last prompt + tool summary + response).

When Claude does something unexpected, the transcript is where you find out what actually happened.

Ctrl+B — Background Running Tasks

Claude is running a long build command and you want to keep working. Press Ctrl+B to move the current bash command to the background. Claude continues with new prompts while the command runs asynchronously. The output gets written to a file that Claude can read later.

Common uses: backgrounding dev servers, test suites, builds, and docker operations. If you use tmux, press Ctrl+B twice (since the first press is the tmux prefix).

Press Ctrl+R to search through your command history interactively. Type part of a previous prompt and it finds matches. Press Ctrl+R again to cycle through older matches. Press Tab to accept and keep editing, or Enter to accept and submit immediately.

If you find yourself re-typing similar prompts across sessions, this is the fix.

Model and Mode Switching

Three shortcuts that change Claude's behavior without leaving the prompt:

ShortcutAction
Alt+PSwitch between models (e.g., Sonnet to Opus) without clearing your prompt
Alt+TToggle extended thinking on or off
Alt+OToggle fast mode on or off
Shift+TabCycle through permission modes: default, acceptEdits, plan, auto

On macOS, the Alt shortcuts require setting Option as Meta in your terminal. In iTerm2: Settings > Profiles > Keys > set Left Option to "Esc+". In VS Code: set "terminal.integrated.macOptionIsMeta": true.

Slash Commands Most Developers Miss

Everyone knows /clear and /compact. Here are the ones that don't get enough attention.

/btw — Side Questions Without Context Pollution

This is arguably the most underrated command in Claude Code. Type /btw followed by a question, and Claude answers it in a dismissible overlay — without adding anything to the conversation history.

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

The side question has full visibility into the current conversation. It can reference code Claude has already read, decisions made earlier, anything from the session. But the question and answer are ephemeral — they never enter the context window.

The key detail: you can use /btw while Claude is actively working. It runs independently and doesn't interrupt the main task. No tool access though — it only answers from what's already in context.

Think of /btw as the inverse of a subagent. A subagent has full tools but starts with an empty context. /btw sees your full conversation but has no tools. Use /btw to recall something Claude already knows. Use a subagent to go find something new.

/effort — Control How Hard Claude Thinks

The /effort command sets how deeply Claude reasons about your prompts. At high effort, Claude activates adaptive reasoning on Opus — spending more time thinking through architecture decisions, tricky debugging, and multi-step logic before acting.

For quick tasks like renaming a variable or adding a comment, lower effort keeps things fast and cheap. For designing a new module or debugging a race condition, high effort is worth every token.

You can set it once and it persists for the session, or adjust it per-task.

/rewind — Surgical Conversation Rollback

The /rewind command (also accessible by double-tapping Escape) opens a checkpoint menu where you can restore previous conversation and code states.

The power move is selective rollback:

  • Rewind code only — reverts all file changes while keeping the conversation history. Claude remembers what it tried and why it failed, but the filesystem goes back to a clean state. Perfect when Claude's approach was wrong but its analysis was right.
  • Rewind conversation only — keeps the code changes but rolls back what Claude remembers. Useful when you want to start a new line of reasoning from the same code state.
  • Summarize from here — condenses messages from a selected point forward. This is a precision tool for context management: instead of /compact which summarizes everything, you target just the verbose section.

/compact With Focus Instructions

Most people run /compact by itself. But it accepts arguments that steer the compression:

/compact Focus on the authentication module changes and the current test failures

This tells Claude what to prioritize when summarizing. Without guidance, /compact makes its own choices about what matters. With a focus instruction, you ensure the compressed summary retains exactly the context you need for the next phase of work.

/context — See Where Your Tokens Go

Running low on context and not sure why? The /context command gives you a visualization of token consumption. It shows how your context window is allocated across conversation history, tool outputs, system instructions, and other sources.

This is the diagnostic tool for understanding why Claude starts forgetting things mid-session or why /compact didn't free up as much space as you expected.

/doctor — Environment Diagnostics

When something isn't working — MCP servers failing to connect, tools behaving unexpectedly, permissions acting weird — run /doctor. It checks your environment for common issues: missing dependencies, misconfigured settings, version incompatibilities.

Instead of manually debugging your setup, let Claude Code diagnose itself.

/insights — Analyze Your Coding Patterns

The /insights command generates an HTML report analyzing your coding habits and usage patterns. It shows which tools you use most, how you interact with Claude, and where your workflow might have bottlenecks.

/export — Save Your Conversation

Need to share a Claude Code session with a colleague or save it for documentation? The /export command exports the conversation to a file or your clipboard. Useful for creating records of complex debugging sessions or architectural decisions.

/teleport — Move Sessions Between Environments

Working locally but want to continue in the browser (or vice versa)? The /teleport command moves sessions between your local CLI and the web environment at claude.ai/code.

Input Tricks

Bash Mode With !

Prefix any input with ! to run a shell command directly without Claude interpreting it:

! npm test
! git status
! docker ps

The command runs immediately and its output gets added to the conversation context. Claude sees the result but didn't decide to run it — you did. This is faster than asking Claude to run a command and waiting for it to route through tool approval.

Bash mode supports Ctrl+B backgrounding and history-based autocomplete: type a partial command and press Tab to complete from previous ! commands in the current project.

@ File Mentions

Type @ anywhere in your prompt to trigger file path autocomplete. Instead of writing out full paths or hoping Claude finds the right file, reference it directly:

Look at @src/auth/middleware.ts and fix the token validation logic

This is faster and more precise than describing which file you mean.

Voice Input

Hold Space for push-to-talk dictation. The transcript inserts at your cursor position. This requires voice dictation to be enabled in settings, but once configured, it's the fastest way to describe complex requirements that are easier to say than type.

Paste Images With Ctrl+V

Need Claude to look at a screenshot, diagram, or error message? Press Ctrl+V (not Cmd+V on most terminals) to paste an image from your clipboard. It inserts an [Image #N] chip that you can reference in your prompt.

On iTerm2, use Cmd+V. On Windows, use Alt+V.

CLI Flags That Transform Claude Code

The command-line flags available when launching Claude Code unlock workflows that most users never explore.

--continue and --resume

These two flags solve the "I closed my terminal and lost everything" problem:

# Resume the most recent session from this directory — no questions asked
claude --continue

# Pick a specific session from an interactive list
claude --resume

--continue is for speed: it loads the most recent session automatically. --resume is for precision: you choose exactly which session to restore. Both preserve your full context — messages, tool state, and configuration.

--name — Tag Your Sessions

claude --name "feature-auth-redesign"

The --name flag assigns a human-readable name when starting a session. When you have multiple concurrent tasks running, names make it trivial to find the right session when using --resume.

Adopt a naming convention like feature-, bugfix-, refactor-, or docs- and your session list becomes scannable at a glance.

-p — Headless Mode

claude -p "Find all TODO comments in the codebase and list them by priority"

The -p flag runs Claude non-interactively: process one prompt, print the result to stdout, exit. No session UI, no conversation — just input and output. This turns Claude Code into a composable CLI tool you can pipe, script, and schedule.

Combine with other flags for more control:

# Restrict which tools Claude can use
claude -p "Fix the lint errors" --allowedTools "Read,Edit,Bash"

# Get structured JSON output
claude -p "List all API endpoints" --output-format json

# Continue a previous headless session
claude -p "Now fix the tests too" --session-id "$SESSION_ID"

--allowedTools — Scoped Permissions

claude --allowedTools "Read,Grep,Glob"

Launch a session where Claude can only use specific tools. Want Claude to analyze code without modifying anything? Restrict it to read-only tools. Want it to edit files but not run commands? Leave out Bash. This is granular control over what Claude can do before the session even starts.

Vim Mode

Enable vim-style editing via /config > Editor mode. Once enabled, you get full vim navigation and editing in the Claude Code prompt:

  • Normal mode: h/j/k/l navigation, w/b/e word movement, f/F/t/T character jumps, gg/G for start/end
  • Editing: dd delete line, cw change word, yy yank line, p paste, . repeat last change
  • Text objects: ciw change inner word, di" delete inner quotes, ya( yank around parens

When the cursor is at the beginning or end of input in normal mode, j/k and arrow keys navigate command history instead of moving the cursor — so you get vim motions and history navigation in one interface.

Session Management

Prompt Suggestions

After Claude responds, a grayed-out suggestion appears in the input based on your conversation history — a follow-up step or natural continuation. Press Tab or Right arrow to accept it. The suggestion is generated via a background request that reuses the conversation's prompt cache, so the cost is minimal.

If you find them distracting, disable them with:

export CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION=false

When your branch has an open pull request, Claude Code shows a clickable PR link in the footer (e.g., "PR #446") with a colored underline:

  • Green: approved
  • Yellow: pending review
  • Red: changes requested
  • Gray: draft
  • Purple: merged

Cmd+click (Mac) or Ctrl+click (Linux/Windows) opens it in your browser. The status updates every 60 seconds. Requires the gh CLI to be installed and authenticated.

Persistent Task Lists

When working on multi-step tasks, Claude creates a task list visible in your terminal's status area. Press Ctrl+T to toggle visibility. Tasks persist across context compactions, so Claude stays organized on longer projects.

To share a task list across sessions — useful when picking up work the next day:

CLAUDE_CODE_TASK_LIST_ID=my-project claude

Key Takeaways

  • Escape stops generation (not Ctrl+C). Double-tap Escape opens the rewind menu for surgical rollback of code, conversation, or both.
  • Ctrl+S stashes your current prompt so you can ask something else first. The stashed text auto-restores afterward.
  • /btw lets you ask side questions without polluting conversation context — and works while Claude is mid-task.
  • /effort controls reasoning depth. Turn it up for architecture and debugging, down for simple edits.
  • /compact accepts focus instructions to steer what the summary retains. Don't run it bare when you need specific context preserved.
  • ! prefix runs shell commands directly in bash mode. Faster than asking Claude to run them.
  • @ file mentions give you autocomplete for file paths directly in your prompt.
  • --continue instantly resumes your last session. --resume lets you pick from a list. --name makes sessions findable.
  • -p headless mode turns Claude Code into a scriptable CLI tool for pipelines and automation.
  • Vim mode, model switching (Alt+P), thinking toggle (Alt+T), and fast mode (Alt+O) are all one shortcut away.

Ship 10x faster with Claude Code

Production-ready CLAUDE.md templates, MCP server configs, custom hooks, and battle-tested workflows. Stop configuring, start building.

  • CLAUDE.md templates for 6+ frameworks with MCP server configs
  • 8+ custom hooks: Pre-commit, lint, test, format & more ready to go
  • Prompt library: 50+ curated prompts and workflow templates