Skip to content
BENIBIX Learn

Bash Tool

AI⌨️ Claude CodeBuilt-in Tools

Also known as Bash, Claude Code Bash tool, Bash(npm run *)

The tool that runs shell commands on your computer.

Think of it like

It is like a friend who types on your keys for you.

Example

Emma asks Claude to fix a failing test. It runs the tests with Bash, reads the error, makes a fix, and runs them again until they pass.

Why it matters

It is what lets Claude check its own work by running it, not just reading it.

Definition

The Bash tool runs shell commands on your computer, such as tests, builds and git. Each command runs in its own process. A change of folder carries over to the next command, but a variable you export does not. A command stops after two minutes by default, and Claude can ask for up to ten. Long jobs, such as a dev server, can run in the background. Bash asks before it runs, unless a rule or your mode allows the command.

Example code

json
{"permissions": {"allow": ["Bash(npm run *)"]}}
Let every npm run script go through without asking.
Bash runs a command and hands back its output.

Common mistake

Allowing Bash with no pattern. That lets every command run, so allow only the ones you trust, like Bash(npm test).

Key takeaways

  1. 1
    Runs commands. Tests, builds, git.
  2. 2
    Two minutes by default. Up to ten.
  3. 3
    Asks first. Unless a rule allows it.

Compare

Learn it properly