← Claude Code Hub
Feb 11, 2026 · 4 min read ✦ Tip #007

Bash Mode in Claude Code: Run Shell Commands Without Leaving It

Type ! followed by any command to run it directly in your shell without leaving Claude Code. Use Ctrl+B for background processes.

Update, November 8, 2026: New section on the Bash you see when Claude runs commands on its own, which is not ! mode.

Claude Code has a built-in bash mode: type ! followed by any command and it runs directly in your shell, without Claude interpreting or approving it. Output appears in real time and gets added to the conversation context — Claude sees the result and can act on it.

This is one of those features you don't discover by reading the docs — you see someone use it. You're debugging, need a quick git log or a cat of a file, and instead of jumping to another tab you just type ! git log --oneline -5. Seems minor, but it eliminates the constant context switching.

It's not an obvious feature, but once you discover it, it changes how you work. No need to open another terminal or split pane. You type, it runs, you keep talking.

TL;DR Prefix any command with ! to run it directly. Use Ctrl+B to send long-running processes to the background. Claude sees the output from both.

Result:

> ! git status

On branch feature/auth
Changes not staged for commit:
  modified:   src/auth/login.ts
  modified:   src/auth/session.ts

The "Bash" you see while Claude works

The Bash that shows up while Claude works is not this mode. It is the name of the tool Claude runs shell commands with on its own: when it decides to run your tests or check git status, it goes through that tool. On screen it sums it up as "Ran 1 shell command"; press Ctrl+O and you see the call by name:

● Bash(touch b.txt && ls)
  ⎿  a.txt
     b.txt

When the command is not read-only, it asks for permission under that same name:

 Bash command
 Tip: auto mode handles these prompts for you — choose "switch to auto mode" below
 Run Python to print 2+2

 python3 -c "print(2+2)"

 This command requires approval
 Do you want to proceed?
 ❯ 1. Yes
   2. Yes, and don’t ask again for: python3 *
   3. Yes, and switch to auto mode · auto mode handles these prompts for you
   4. No

Option 2 saves the rule Bash(python3 *) to the project's .claude/settings.local.json, the same format you write by hand in permissions.allow or permissions.deny; and plain Bash is the name you put in a hook's matcher or a subagent's tool list. Read-only commands such as ls, cat, grep or git status run without asking. On Windows, Claude can run commands with the PowerShell tool instead of Bash.

The difference is who types the command: with ! you do, and it skips permissions; with the Bash tool Claude proposes it, and a rule or you approve it.

How to use it

1. Run a quick command

Type ! followed by the command:

! npm test
! git diff --stat
! ls -la src/

Claude doesn't intervene — the command goes straight to your shell. But the output is added to the conversation, so you can ask "what failed?" right after.

2. Send a long process to the background

If a command takes too long (builds, tests, dev servers), press Ctrl+B while it's running:

! npm run build
# taking too long → press Ctrl+B
# Claude is available again while the build finishes in background

You can also ask Claude directly to run something in the background.

One distinction worth holding on to: Ctrl+B backgrounds a command of yours, and that costs nothing. When the thing running in the background is a subagent, it's a different story, because there it does lose built-in tools even when you declared them: here is the list.

3. History-based autocomplete

Type ! followed by the first few letters and press Tab. Claude Code autocompletes from previous ! commands in the current project.

! np  → Tab → ! npm test

And to search your previous prompts, not just ! commands? Press Ctrl+R for reverse search over your prompt history — across every project, too.

Reference

Aspect Detail
Prefix ! at the start of input
Execution Directly in your shell, no Claude interpretation
Output Shown in real time and added to conversation context
Background Ctrl+B during execution (tmux: press twice)
Autocomplete Tab completes from project's ! command history
Permissions No approval needed — it's your terminal

Official docs: Interactive mode — Bash mode

Found this useful? See more of wmedia.es in your Google results.

Add wmedia.es as a preferred source on Google
FREE GUIDE

You don't need Opus every time.

Model and effort are two settings, not one. 8 pages with the settings that actually move your bill, a three-question diagnostic for when something fails, and the price ladder.

  • 1. What "better" means capability, time and money
  • 2. Model who you send
  • 3. Effort how much rope you give
  • 4. Diagnostic three questions when something fails
  • 5. The bill where it comes from
Are you a professional Web developer?

You'll receive the guide by email · You join the Gravitas newsletter · Unsubscribe anytime

of 8
#

Wmedia · 8 pages
FREE GUIDE · 8 pages · 2 dials

You don't need Opus every time.

Model and effort are two settings, not one. 8 pages with the settings that actually move your bill, a three-question diagnostic for when something fails, and the price ladder.

Are you a professional Web developer? · Unsubscribe anytime
How I use AI

My Claude Code workflow.

The skills, agents and instructions I use as a professional Software Engineer. It's called Craft, and it's a plugin you can install.

See the skills

Using Opus for everything? See when you don't need it.