Type ! Before a Command to Run It Inline Without Leaving Your Session
Sometimes you want to run a command yourself — check test output, verify a build, or inspect something — without asking Claude to do it and without leaving the session. Just prefix with !.
! npm test
The command runs in your shell and the output lands directly in the conversation. Claude sees it too, so you can immediately follow up with "fix that failing test" and it already has the error output.
This is useful when you want to stay in control:
# Check the current state before asking Claude to make changes
! git status
! git diff --stat
# Run tests yourself to verify Claude's changes
! php artisan test --compact
# Inspect something without burning Claude's tool-use turns
! docker ps
! curl -s localhost:3000/health
The difference from asking Claude to run a command:
! command— you run it. Instant, no approval needed, no tool call. Output goes into the conversation as context.- "run command" — Claude runs it. Goes through the tool-use flow, may need permission approval, counts toward turns.
A few practical patterns:
# Start a dev server in the background
! npm run dev &
# Check logs while debugging with Claude
! tail -20 storage/logs/laravel.log
# Verify a migration before Claude writes the next one
! php artisan migrate:status
The ! command inherits your full shell environment — aliases, PATH, environment variables, everything. It's exactly like running the command in your terminal, but the output stays in Claude's context.
! keeps you in the driver's seat — run commands yourself when you want control, ask Claude when you want help.
via Claude Code
Log in to leave a comment.
When typing feels slow — describing a complex bug, explaining architecture, or thinking through a problem out loud — press Option+V to switch to voice input. Speak naturally and Claude Code transcribes your words into a prompt, so you can describe what you need at the speed of thought.
When Claude is heading down the wrong path — editing the wrong file, writing code you don't want, or giving a long explanation you don't need — press Escape to stop it immediately. You keep everything it did up to that point and can redirect with a new prompt.
Closed a session and realized you weren't done? Pass --continue (or -c) when launching Claude Code to pick up exactly where you left off — same context, same files, same conversation history — without re-explaining what you were working on.