Antigravity-awesome-skills bash-linux
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
install
source · Clone the upstream repo
git clone https://github.com/benjaminasterA/antigravity-awesome-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/benjaminasterA/antigravity-awesome-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/bash-linux" ~/.claude/skills/benjaminastera-antigravity-awesome-skills-bash-linux && rm -rf "$T"
manifest:
skills/bash-linux/SKILL.mdsource content
Bash Linux Patterns
Essential patterns for Bash on Linux/macOS.
1. Operator Syntax
Chaining Commands
| Operator | Meaning | Example |
|---|---|---|
| Run sequentially | |
| Run if previous succeeded | |
| Run if previous failed | |
| Pipe output | |
2. File Operations
Essential Commands
| Task | Command |
|---|---|
| List all | |
| Find files | |
| File content | |
| First N lines | |
| Last N lines | |
| Follow log | |
| Search in files | |
| File size | |
| Disk usage | |
3. Process Management
| Task | Command |
|---|---|
| List processes | |
| Find by name | |
| Kill by PID | |
| Find port user | |
| Kill port | |
| Background | |
| Jobs | |
| Bring to front | |
4. Text Processing
Core Tools
| Tool | Purpose | Example |
|---|---|---|
| Search | |
| Replace | |
| Extract columns | |
| Cut fields | |
| Sort lines | |
| Unique lines | |
| Count | |
5. Environment Variables
| Task | Command |
|---|---|
| View all | or |
| View one | |
| Set temporary | |
| Set in script | |
| Add to PATH | |
6. Network
| Task | Command |
|---|---|
| Download | |
| API request | |
| POST JSON | |
| Check port | |
| Network info | or |
7. Script Template
#!/bin/bash set -euo pipefail # Exit on error, undefined var, pipe fail # Colors (optional) RED='\033[0;31m' GREEN='\033[0;32m' NC='\033[0m' # Script directory SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # Functions log_info() { echo -e "${GREEN}[INFO]${NC} $1"; } log_error() { echo -e "${RED}[ERROR]${NC} $1" >&2; } # Main main() { log_info "Starting..." # Your logic here log_info "Done!" } main "$@"
8. Common Patterns
Check if command exists
if command -v node &> /dev/null; then echo "Node is installed" fi
Default variable value
NAME=${1:-"default_value"}
Read file line by line
while IFS= read -r line; do echo "$line" done < file.txt
Loop over files
for file in *.js; do echo "Processing $file" done
9. Differences from PowerShell
| Task | PowerShell | Bash |
|---|---|---|
| List files | | |
| Find files | | |
| Environment | | |
| String concat | | (same) |
| Null check | | |
| Pipeline | Object-based | Text-based |
10. Error Handling
Set options
set -e # Exit on error set -u # Exit on undefined variable set -o pipefail # Exit on pipe failure set -x # Debug: print commands
Trap for cleanup
cleanup() { echo "Cleaning up..." rm -f /tmp/tempfile } trap cleanup EXIT
Remember: Bash is text-based. Use
for success chains,&&for safety, and quote your variables!set -e
When to Use
This skill is applicable to execute the workflow or actions described in the overview.