← Claude Code Hub
Feb 11, 2026 · 3 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.

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

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

Approve less, but better.

Ten minutes in, you're hitting yes without reading. That's not review, that's prayer. A 10-page guide with the five levers in order of risk.

  • 1. Rules the first match wins
  • 2. Mode a dial, not a switch
  • 3. Auto mode a classifier approves for you
  • 4. Sandbox a fence the OS puts up
  • 5. Bypass only inside a container
Are you a professional Web developer?

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

of 10
#

Wmedia · 10 pages
FREE GUIDE · 10 pages · 5 levers

Approve less, but better.

Ten minutes in, you're hitting yes without reading. That's not review, that's prayer. A 10-page guide with the five levers in order of risk.

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

Tired of approving permissions without reading?