brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: a leading ! runs a shell command inside Claude Code

Shell
~/tips/tip-claude-bang-shell-mode

! npm test

Runs a shell command from the Claude Code prompt and puts the output in the conversation.

I find it silly to leave a session just to run git status. You do not have to.

Start a line in the Claude Code prompt with ! and it runs as a shell command, straight away. Claude does not have to interpret or approve it. The command and its output are added to the conversation, so Claude can respond to the result.

! npm test

Example: run the tests with ! npm test, then just type fix the failing one. Claude has already seen the output. Long-running commands can be sent to the background with Ctrl+B, and Tab completes from your earlier ! commands in the project.

I would use this for the small stuff: checking a branch name, listing a folder, running the tests once before asking for a fix. It saves a round trip through the model, and it saves a permission prompt too, because you typed the command yourself.

To leave shell mode, press Escape, Backspace or Ctrl+U on an empty prompt. One caveat: pasting text that starts with ! into an empty prompt switches you into shell mode as well, so check what you paste.

Further reading: Interactive mode – Claude Code docs, On this site: add a Notification hook so Claude Code pings you when it waits, On this site: name your Claude Code sessions and resume them by name

More Shell tips zmv -n '(*).log' '$1.txt' zoxide query -ls project f=$(mktemp --suffix=.json) shopt globskipdots echo $EPOCHSECONDS All Shell tips (78) All topics

Link