// 68 tips tagged "bash"
The SessionStart hook fires when any session begins or resumes, making it ideal for loading environment variables and running one-time setup scripts.
Describe your server setup in plain English and let Claude write a complete, idempotent Ansible playbook — modules, handlers, roles, and all the boilerplate you'd otherwise look up.
A PreToolUse hook can intercept test runner commands and filter output to show only failures, cutting thousands of tokens from Claude's context.
Start a Claude Code session in your terminal and continue it on the web, or pull a web session into your local terminal with --remote and --teleport.
Combine shell loops with claude --print to apply AI-powered transformations to hundreds of files in one go — add headers, convert formats, or extract data at scale.
When Claude generates shell scripts for you, ask it to add `set -euo pipefail` at the top — three flags that turn silent failures into hard stops.
CLI tools like gh, aws, and gcloud don't add persistent tool definitions to your context, saving tokens compared to equivalent MCP servers.
Use --json-schema to get validated, schema-conforming JSON output from Claude Code in automated pipelines.
claude --help and its subcommand variants give you a full reference for every flag and option without opening a browser — useful when you're in the middle of a script or a flow state.
Use --fork-session to branch a conversation into a new session, keeping the original intact while exploring alternatives.
Set a backup model with --fallback-model so automated tasks survive temporary model overloads without failing.
In CI environments where no human is present to approve tool calls, --dangerously-skip-permissions lets Claude Code run without any permission prompts — use it only in sandboxed, throwaway environments.