notify-before-bash — Claude Code hook: what it does, how to install
Prints a terminal notice before Claude Code executes any Bash command. Useful for keeping an eye on shell activity during coding sessions.
npx claude-code-templates@latest --hook pre-tool/notify-before-bashWhat notify-before-bash does
This hook hooks into the PreToolUse event for the Bash tool. Every time Claude prepares to run a terminal instruction, it prints 🔔 About to run bash command... to stdout.
The action runs a plain shell echo configured directly in JSON. Because it depends on nothing outside your existing environment, setup takes only a few seconds.
The hook merely prints a message to your screen without parsing arguments or halting execution.
What it helps with
- spot shell command attempts before they run
- keep track of Claude Code accessing the operating system terminal
- monitor command executions visually during automated workflows
Example prompts for the agent
- Run the test suite with
npm test - Check current disk usage in this directory
How to install notify-before-bash
1claude-code-templates
npx claude-code-templates@latest --hook pre-tool/notify-before-bash2Manually: put the files in place
.claude/settings.jsonThe hooks block: event (PreToolUse, PostToolUse, Stop…) → command. Personal ones go to ~/.claude/settings.json
Step by step, with commands for each platform: Claude Code hooks: what they are, where to configure them, how to block a risky command
Questions about notify-before-bash
How to install notify-before-bash in Claude Code?
Run npx claude-code-templates@latest --hook pre-tool/notify-before-bash or insert the hook settings directly into .claude/settings.json.
What does notify-before-bash do?
It intercepts the PreToolUse event for Bash and echoes an alert line right before Claude executes the command.
Does notify-before-bash block dangerous operations?
No, it only prints a notification string and does not inspect or abort command execution.
Source text
notify-before-bash.json · MIT
{
"description": "Show notification before any Bash command execution for security awareness. This hook displays a simple echo message '🔔 About to run bash command...' before Claude executes any bash command, giving you visibility into when system commands are about to run. Useful for monitoring and auditing command execution.",
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "echo '🔔 About to run bash command...'"
}
]
}
]
}
}
© davila7 · MIT · davila7/claude-code-templates