Run a shell command without leaving the prompt

keyboard shortcuts

// what it does

Start any input with ! to run it as a shell command directly, without Claude interpreting or approving it. The command and its output are added to the conversation context, and as of v2.1.186 Claude responds to that output automatically — so ! npm test surfaces an explanation of the failures with no second prompt. Exit shell mode with Esc, Backspace, or Ctrl+U on an empty prompt.

// shortcut

!

// shell

$ ! npm test
$ ! git status

// gotcha

To go back to the old behavior where the output is added to context without Claude responding, set respondToBashCommands to false in settings.json. Note the auto-response costs the same as sending a normal prompt.

// resources