# Bash Permission Rule

> A rule like Bash(npm run *) that covers shell commands.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** Bash(npm run *), Bash rule

## Think of it like

It is like a list on the fridge. It says which jobs you may do without asking.

## Definition

A Bash permission rule matches the shell commands Claude wants to run. It is written as Bash and the command, such as Bash(npm run *). A star stands for any text. A bare Bash rule covers every command. The rule matches the text Claude writes, so the same program called another way can slip past it.

## Example

Jack lets npm test run without a prompt. He denies git push, so nothing leaves his laptop.

## Example code

```json
{
  "permissions": {
    "allow": ["Bash(npm run *)", "Bash(git commit *)"],
    "deny": ["Bash(git push *)"]
  }
}
```

Run scripts and commits freely, never push.

## Why it matters

Most of Claude's work runs through the shell. These rules decide how often you are asked.

## Common mistake

Trusting a deny rule as a wall. /bin/rm or sh -c 'rm' is not the same text as rm. Use the sandbox for a hard limit.

## Three principles

- **Bash and a command.** Bash(npm run *).
- **Star is any text.** One rule, many commands.
- **Text, not program.** Not a wall.

## Related terms

- [Permission Rule](https://learn.benibix.com/term/ai/permission-rule)
- [Bash Tool](https://learn.benibix.com/term/ai/bash-tool)
- [Permission Rule Wildcard](https://learn.benibix.com/term/ai/permission-rule-wildcard)

## Told apart from

- [Bash Permission Rule vs Sandbox](https://learn.benibix.com/compare/bash-permission-rule-vs-claude-code-sandbox): People think a Bash deny rule is a wall around a program. It is a check on the text Claude writes. Bash(rm *) stops rm, but not /bin/rm or sh -c 'rm'. The sandbox works lower down. It limits which files and hosts any command can reach, however it is spelled. Use rules to cut prompts, and the sandbox for a hard limit.
- [excludedCommands vs Bash Permission Rule](https://learn.benibix.com/compare/excluded-commands-setting-vs-bash-permission-rule): People think putting a command in excludedCommands lets it run without asking. It does not. The list only takes a command out of the sandbox, so it runs with your full access. It still goes through your rules and your mode. In Manual mode, it still needs a Bash allow rule to skip the prompt.

![Where the star goes in a Bash rule decides which commands it covers.](https://learn.benibix.com/diagrams/permission-wildcard.svg)

---

Source: https://learn.benibix.com/term/ai/bash-permission-rule
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
