Linux Bash
About
This skill provides expert assistance with Linux bash commands, shell scripting, and system administration tasks. It helps developers with file operations, process management, and using command-line utilities. Use it when writing bash scripts or performing Linux system operations from the command line.
Documentation
Linux Bash
Expert guidance for Linux bash operations, scripting, and system administration.
Core Commands
File Operations
ls -lah- List files with details, including hiddenfind /path -name "pattern"- Find files by namegrep -r "pattern" /path- Recursive text searchchmod +x file- Make file executablechown user:group file- Change ownershiptar -czf archive.tar.gz dir/- Create compressed archivetar -xzf archive.tar.gz- Extract archive
Process Management
ps aux | grep process- Find running processestop/htop- Monitor system resourceskill -9 PID- Force kill processnohup command &- Run command in backgroundjobs- List background jobsfg %1- Bring job to foreground
System Information
df -h- Disk usage human-readabledu -sh dir/- Directory sizefree -h- Memory usageuname -a- System informationlsb_release -a- Distribution info
Text Processing
cat file | head -n 10- First 10 linestail -f log.txt- Follow log filesed 's/old/new/g' file- Replace textawk '{print $1}' file- Print first columnsort file | uniq- Remove duplicates
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
"$variable"to prevent word splitting - Use [[ ]] for tests: More features than [ ]
- Shellcheck: Use
shellcheck script.shto validate scripts - Exit codes: Use
$?to check last command status - Debugging: Use
set -xto trace execution
Safety First
- Always test scripts in safe environment first
- Use
set -eto exit on errors - Validate input parameters
- Quote file paths to handle spaces
- Use absolute paths when possible
Quick Install
/plugin add https://github.com/oriolrius/pki-manager-web/tree/main/linux-bashCopy and paste this command in Claude Code to install this skill
GitHub 仓库
Related Skills
subagent-driven-development
DevelopmentThis skill executes implementation plans by dispatching a fresh subagent for each independent task, with code review between tasks. It enables fast iteration while maintaining quality gates through this review process. Use it when working on mostly independent tasks within the same session to ensure continuous progress with built-in quality checks.
cost-optimization
OtherThis Claude Skill helps developers optimize cloud costs through resource rightsizing, tagging strategies, and spending analysis. It provides a framework for reducing cloud expenses and implementing cost governance across AWS, Azure, and GCP. Use it when you need to analyze infrastructure costs, right-size resources, or meet budget constraints.
Git Commit Helper
MetaThis Claude Skill generates descriptive commit messages by analyzing git diffs. It automatically follows conventional commit format with proper types like feat, fix, and docs. Use it when you need help writing commit messages or reviewing staged changes in your repository.
algorithmic-art
MetaThis Claude Skill creates original algorithmic art using p5.js with seeded randomness and interactive parameters. It generates .md files for algorithmic philosophies, plus .html and .js files for interactive generative art implementations. Use it when developers need to create flow fields, particle systems, or other computational art while avoiding copyright issues.
