Claude-skill-registry Linux Bash
Expert assistance with Linux bash commands, shell scripting, system administration, file operations, and command-line utilities. Use this when working with bash scripts, Linux system operations, or command-line tasks.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/linux-bash" ~/.claude/skills/majiayu000-claude-skill-registry-linux-bash && rm -rf "$T"
manifest:
skills/data/linux-bash/SKILL.mdsource content
Linux Bash
Expert guidance for Linux bash operations, scripting, and system administration.
Core Commands
File Operations
- List files with details, including hiddenls -lah
- Find files by namefind /path -name "pattern"
- Recursive text searchgrep -r "pattern" /path
- Make file executablechmod +x file
- Change ownershipchown user:group file
- Create compressed archivetar -czf archive.tar.gz dir/
- Extract archivetar -xzf archive.tar.gz
Process Management
- Find running processesps aux | grep process
/top
- Monitor system resourceshtop
- Force kill processkill -9 PID
- Run command in backgroundnohup command &
- List background jobsjobs
- Bring job to foregroundfg %1
System Information
- Disk usage human-readabledf -h
- Directory sizedu -sh dir/
- Memory usagefree -h
- System informationuname -a
- Distribution infolsb_release -a
Text Processing
- First 10 linescat file | head -n 10
- Follow log filetail -f log.txt
- Replace textsed 's/old/new/g' file
- Print first columnawk '{print $1}' file
- Remove duplicatessort file | uniq
Shell Scripting Best Practices
Script Template
#!/bin/bash set -euo pipefail # Exit on error, undefined vars, pipe failures # Script description readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" main() { # Your logic here echo "Hello, World!" } main "$@"
Error Handling
# Check command success if ! command -v tool &> /dev/null; then echo "Error: tool not found" >&2 exit 1 fi # Trap errors trap 'echo "Error on line $LINENO"' ERR
Variables
# Constants (uppercase) readonly CONFIG_FILE="/etc/app.conf" # Variables (lowercase) user_input="$1" # Arrays files=("file1.txt" "file2.txt") for file in "${files[@]}"; do echo "$file" done
Common Patterns
Check if file exists
if [[ -f "file.txt" ]]; then echo "File exists" fi
Loop through files
for file in *.txt; do echo "Processing $file" done
Read user input
read -p "Enter value: " user_value
Function definition
my_function() { local arg1="$1" echo "Received: $arg1" }
Tips
- Quote variables: Always use
to prevent word splitting"$variable" - Use [[ ]] for tests: More features than [ ]
- Shellcheck: Use
to validate scriptsshellcheck script.sh - Exit codes: Use
to check last command status$? - Debugging: Use
to trace executionset -x
Safety First
- Always test scripts in safe environment first
- Use
to exit on errorsset -e - Validate input parameters
- Quote file paths to handle spaces
- Use absolute paths when possible