Loading...
Loading...
Bash/Linux terminal patterns. Critical commands, piping, error handling, scripting. Use when working on macOS or Linux systems.
npx skill4agent add davila7/claude-code-templates bash-linuxEssential patterns for Bash on Linux/macOS.
| Operator | Meaning | Example |
|---|---|---|
| Run sequentially | |
| Run if previous succeeded | |
| Run if previous failed | |
| Pipe output | |
| Task | Command |
|---|---|
| List all | |
| Find files | |
| File content | |
| First N lines | |
| Last N lines | |
| Follow log | |
| Search in files | |
| File size | |
| Disk usage | |
| Task | Command |
|---|---|
| List processes | |
| Find by name | |
| Kill by PID | |
| Find port user | |
| Kill port | |
| Background | |
| Jobs | |
| Bring to front | |
| Tool | Purpose | Example |
|---|---|---|
| Search | |
| Replace | |
| Extract columns | |
| Cut fields | |
| Sort lines | |
| Unique lines | |
| Count | |
| Task | Command |
|---|---|
| View all | |
| View one | |
| Set temporary | |
| Set in script | |
| Add to PATH | |
| Task | Command |
|---|---|
| Download | |
| API request | |
| POST JSON | |
| Check port | |
| Network info | |
#!/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 "$@"if command -v node &> /dev/null; then
echo "Node is installed"
fiNAME=${1:-"default_value"}while IFS= read -r line; do
echo "$line"
done < file.txtfor file in *.js; do
echo "Processing $file"
done| Task | PowerShell | Bash |
|---|---|---|
| List files | | |
| Find files | | |
| Environment | | |
| String concat | | |
| Null check | | |
| Pipeline | Object-based | Text-based |
set -e # Exit on error
set -u # Exit on undefined variable
set -o pipefail # Exit on pipe failure
set -x # Debug: print commandscleanup() {
echo "Cleaning up..."
rm -f /tmp/tempfile
}
trap cleanup EXITRemember: Bash is text-based. Usefor success chains,&&for safety, and quote your variables!set -e