Skip to content
BENIBIX Learn

! Shell Mode

AI⌨️ Claude CodeKeyboard Shortcuts

Also known as bang prefix, run a shell command in Claude Code

The ! prefix that runs your own shell command and puts its output in the chat.

Think of it like

It is like doing a job by hand while a friend looks on. Then you ask what they think.

Example

Leo types ! npm test. The tests fail, and Claude explains why without a second prompt.

Why it matters

You can run a quick command yourself and still give Claude what it printed.

Definition

Shell mode is the Claude Code feature you start by typing ! at the start of the prompt. The command runs in your shell at once, with no approval, and its output joins the chat. Claude then replies to it, at the cost of a normal prompt. It runs outside the sandbox, because the sandbox fences only Claude's commands. Esc or Backspace on an empty prompt leaves it.

Example code

console
! npm test
Run the tests yourself. Claude sees the output and explains the failures.
Your command runs, then Claude reads the output.

Common mistake

Thinking the sandbox fences it. Commands you type with ! run outside the sandbox.

Key takeaways

  1. 1
    Your command, run now. No approval.
  2. 2
    Output joins the chat. Claude replies.
  3. 3
    Outside the sandbox. Not fenced.

Compare

Learn it properly