Overview
The Bash/Linux skill provides essential patterns for working with Bash shells on Linux and macOS systems. It covers command chaining, file operations, process management, text processing, scripting, and error handling.What This Skill Provides
- Command chaining operators:
;,&&,||,|for sequential and conditional execution - File operations: Essential commands for listing, searching, and manipulating files
- Process management: Finding, managing, and killing processes by PID or port
- Text processing: Using grep, sed, awk, cut, sort, uniq, and wc
- Environment variables: Setting, viewing, and managing environment configuration
- Network operations: curl, nc, and network information commands
- Script templates: Production-ready Bash script structure with error handling
- Common patterns: Command checking, default values, file reading, loops
- Error handling: set options and cleanup traps
Use Cases
- Automating development workflows with shell scripts
- Managing processes and finding what’s using specific ports
- Text processing and data extraction from files
- Debugging network issues and making API requests
- Writing robust shell scripts with proper error handling
- Chaining commands for complex operations
Related Skills
- PowerShell Windows - Windows equivalent
- Server Management - Server administration
- Deployment Procedures - Deployment automation
- Systematic Debugging - Debugging with shell tools
Which Agents Use This Skill
This skill is commonly used by:- Backend developers working on Linux/macOS
- DevOps engineers writing deployment scripts
- System administrators managing servers
- Data engineers processing text files
Key Principles
Command Chaining
| Operator | Meaning | Example | ||||
|---|---|---|---|---|---|---|
; | Run sequentially | cmd1; cmd2 | ||||
&& | Run if previous succeeded | npm install && npm run dev | ||||
| ` | ` | Run if previous failed | `npm test | echo “Tests failed”` | ||
| ` | ` | Pipe output | `ls | grep “.js”` |
Text-Based Pipeline
Bash pipelines are text-based (unlike PowerShell’s object-based approach). Always quote variables and consider word splitting.Error Handling with Set Options
Script Template
Common Patterns
Check if Command Exists
Default Variable Value
Cleanup on Exit
Differences from PowerShell
| Task | PowerShell | Bash |
|---|---|---|
| List files | Get-ChildItem | ls -la |
| Find files | Get-ChildItem -Recurse | find . -type f |
| Environment | $env:VAR | $VAR |
| Null check | if ($x) | if [ -n "$x" ] |
| Pipeline | Object-based | Text-based |
Remember
Bash is text-based. Use&& for success chains, set -e for safety, and quote your variables!