[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79WB35X9AEK9PC3XZASZBMS":3,"skill-same:01M79WB35X9AEK9PC3XZASZBMS":46},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":13,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M79WB35X9AEK9PC3XZASZBMS","Linux Production Shell Scripts",null,"This skill should be used when the user asks to \"create bash scripts\", \"automate Linux tasks\", \"monitor system resources\", \"backup files\", \"manage users\", or \"write production shell scripts\". It provides ready-to-use shell script templates for system administration.","KrismithReddy12\u002Fclaude-code-templates","KrismithReddy12","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F182916557?v=4","01M79T8DNGJRHG48G3H3Q02MK8","01M79TA8ZWV2PP7R4ARWVYWZFE",0,"MIT","https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Flinux-shell-scripting\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: Linux Production Shell Scripts\ndescription: This skill should be used when the user asks to \"create bash scripts\", \"automate Linux tasks\", \"monitor system resources\", \"backup files\", \"manage users\", or \"write production shell scripts\". It provides ready-to-use shell script templates for system administration.\nmetadata:\n  author: zebbern\n  version: \"1.1\"\n---\n\n# Linux Production Shell Scripts\n\n## Purpose\n\nProvide production-ready shell script templates for common Linux system administration tasks including backups, monitoring, user management, log analysis, and automation. These scripts serve as building blocks for security operations and penetration testing environments.\n\n## Prerequisites\n\n### Required Environment\n- Linux\u002FUnix system (bash shell)\n- Appropriate permissions for tasks\n- Required utilities installed (rsync, openssl, etc.)\n\n### Required Knowledge\n- Basic bash scripting\n- Linux file system structure\n- System administration concepts\n\n## Outputs and Deliverables\n\n1. **Backup Solutions** - Automated file and database backups\n2. **Monitoring Scripts** - Resource usage tracking\n3. **Automation Tools** - Scheduled task execution\n4. **Security Scripts** - Password management, encryption\n\n## Core Workflow\n\n### Phase 1: File Backup Scripts\n\n**Basic Directory Backup**\n```bash\n#!\u002Fbin\u002Fbash\nbackup_dir=\"\u002Fpath\u002Fto\u002Fbackup\"\nsource_dir=\"\u002Fpath\u002Fto\u002Fsource\"\n\n# Create a timestamped backup of the source directory\ntar -czf \"$backup_dir\u002Fbackup_$(date +%Y%m%d_%H%M%S).tar.gz\" \"$source_dir\"\necho \"Backup completed: backup_$(date +%Y%m%d_%H%M%S).tar.gz\"\n```\n\n**Remote Server Backup**\n```bash\n#!\u002Fbin\u002Fbash\nsource_dir=\"\u002Fpath\u002Fto\u002Fsource\"\nremote_server=\"user@remoteserver:\u002Fpath\u002Fto\u002Fbackup\"\n\n# Backup files\u002Fdirectories to a remote server using rsync\nrsync -avz --progress \"$source_dir\" \"$remote_server\"\necho \"Files backed up to remote server.\"\n```\n\n**Backup Rotation Script**\n```bash\n#!\u002Fbin\u002Fbash\nbackup_dir=\"\u002Fpath\u002Fto\u002Fbackups\"\nmax_backups=5\n\n# Rotate backups by deleting the oldest if more than max_backups\nwhile [ $(ls -1 \"$backup_dir\" | wc -l) -gt \"$max_backups\" ]; do\n    oldest_backup=$(ls -1t \"$backup_dir\" | tail -n 1)\n    rm -r \"$backup_dir\u002F$oldest_backup\"\n    echo \"Removed old backup: $oldest_backup\"\ndone\necho \"Backup rotation completed.\"\n```\n\n**Database Backup Script**\n```bash\n#!\u002Fbin\u002Fbash\ndatabase_name=\"your_database\"\ndb_user=\"username\"\ndb_pass=\"password\"\noutput_file=\"database_backup_$(date +%Y%m%d).sql\"\n\n# Perform database backup using mysqldump\nmysqldump -u \"$db_user\" -p\"$db_pass\" \"$database_name\" > \"$output_file\"\ngzip \"$output_file\"\necho \"Database backup created: $output_file.gz\"\n```\n\n### Phase 2: System Monitoring Scripts\n\n**CPU Usage Monitor**\n```bash\n#!\u002Fbin\u002Fbash\nthreshold=90\n\n# Monitor CPU usage and trigger alert if threshold exceeded\ncpu_usage=$(top -bn1 | grep \"Cpu(s)\" | awk '{print $2}' | cut -d. -f1)\n\nif [ \"$cpu_usage\" -gt \"$threshold\" ]; then\n    echo \"ALERT: High CPU usage detected: $cpu_usage%\"\n    # Add notification logic (email, slack, etc.)\n    # mail -s \"CPU Alert\" admin@example.com \u003C\u003C\u003C \"CPU usage: $cpu_usage%\"\nfi\n```\n\n**Disk Space Monitor**\n```bash\n#!\u002Fbin\u002Fbash\nthreshold=90\npartition=\"\u002Fdev\u002Fsda1\"\n\n# Monitor disk usage and trigger alert if threshold exceeded\ndisk_usage=$(df -h | grep \"$partition\" | awk '{print $5}' | cut -d% -f1)\n\nif [ \"$disk_usage\" -gt \"$threshold\" ]; then\n    echo \"ALERT: High disk usage detected: $disk_usage%\"\n    # Add alert\u002Fnotification logic here\nfi\n```\n\n**CPU Usage Logger**\n```bash\n#!\u002Fbin\u002Fbash\noutput_file=\"cpu_usage_log.txt\"\n\n# Log current CPU usage to a file with timestamp\ntimestamp=$(date '+%Y-%m-%d %H:%M:%S')\ncpu_usage=$(top -bn1 | grep 'Cpu(s)' | awk '{print $2}' | cut -d. -f1)\necho \"$timestamp - CPU Usage: $cpu_usage%\" >> \"$output_file\"\necho \"CPU usage logged.\"\n```\n\n**System Health Check**\n```bash\n#!\u002Fbin\u002Fbash\noutput_file=\"system_health_check.txt\"\n\n# Perform system health check and save results to a file\n{\n    echo \"System Health Check - $(date)\"\n    echo \"================================\"\n    echo \"\"\n    echo \"Uptime:\"\n    uptime\n    echo \"\"\n    echo \"Load Average:\"\n    cat \u002Fproc\u002Floadavg\n    echo \"\"\n    echo \"Memory Usage:\"\n    free -h\n    echo \"\"\n    echo \"Disk Usage:\"\n    df -h\n    echo \"\"\n    echo \"Top Processes:\"\n    ps aux --sort=-%cpu | head -10\n} > \"$output_file\"\n\necho \"System health check saved to $output_file\"\n```\n\n### Phase 3: User Management Scripts\n\n**User Account Creation**\n```bash\n#!\u002Fbin\u002Fbash\nusername=\"newuser\"\n\n# Check if user exists; if not, create new user\nif id \"$username\" &>\u002Fdev\u002Fnull; then\n    echo \"User $username already exists.\"\nelse\n    useradd -m -s \u002Fbin\u002Fbash \"$username\"\n    echo \"User $username created.\"\n    \n    # Set password interactively\n    passwd \"$username\"\nfi\n```\n\n**Password Expiry Checker**\n```bash\n#!\u002Fbin\u002Fbash\noutput_file=\"password_expiry_report.txt\"\n\n# Check password expiry for users with bash shell\necho \"Password Expiry Report - $(date)\" > \"$output_file\"\necho \"=================================\" >> \"$output_file\"\n\nIFS=$'\\n'\nfor user in $(grep \"\u002Fbin\u002Fbash\" \u002Fetc\u002Fpasswd | cut -d: -f1); do\n    password_expires=$(chage -l \"$user\" 2>\u002Fdev\u002Fnull | grep \"Password expires\" | awk -F: '{print $2}')\n    echo \"User: $user - Password Expires: $password_expires\" >> \"$output_file\"\ndone\nunset IFS\n\necho \"Password expiry report saved to $output_file\"\n```\n\n### Phase 4: Security Scripts\n\n**Password Generator**\n```bash\n#!\u002Fbin\u002Fbash\nlength=${1:-16}\n\n# Generate a random password\npassword=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9!@#$%^&*' | head -c\"$length\")\necho \"Generated password: $password\"\n```\n\n**File Encryption Script**\n```bash\n#!\u002Fbin\u002Fbash\nfile=\"$1\"\naction=\"${2:-encrypt}\"\n\nif [ -z \"$file\" ]; then\n    echo \"Usage: $0 \u003Cfile> [encrypt|decrypt]\"\n    exit 1\nfi\n\nif [ \"$action\" == \"encrypt\" ]; then\n    # Encrypt file using AES-256-CBC\n    openssl enc -aes-256-cbc -salt -pbkdf2 -in \"$file\" -out \"$file.enc\"\n    echo \"File encrypted: $file.enc\"\nelif [ \"$action\" == \"decrypt\" ]; then\n    # Decrypt file\n    output_file=\"${file%.enc}\"\n    openssl enc -aes-256-cbc -d -pbkdf2 -in \"$file\" -out \"$output_file\"\n    echo \"File decrypted: $output_file\"\nfi\n```\n\n### Phase 5: Log Analysis Scripts\n\n**Error Log Extractor**\n```bash\n#!\u002Fbin\u002Fbash\nlogfile=\"${1:-\u002Fvar\u002Flog\u002Fsyslog}\"\noutput_file=\"error_log_$(date +%Y%m%d).txt\"\n\n# Extract lines with \"ERROR\" from the log file\ngrep -i \"error\\|fail\\|critical\" \"$logfile\" > \"$output_file\"\necho \"Error log created: $output_file\"\necho \"Total errors found: $(wc -l \u003C \"$output_file\")\"\n```\n\n**Web Server Log Analyzer**\n```bash\n#!\u002Fbin\u002Fbash\nlog_file=\"${1:-\u002Fvar\u002Flog\u002Fapache2\u002Faccess.log}\"\n\necho \"Web Server Log Analysis\"\necho \"========================\"\necho \"\"\necho \"Top 10 IP Addresses:\"\nawk '{print $1}' \"$log_file\" | sort | uniq -c | sort -rn | head -10\necho \"\"\necho \"Top 10 Requested URLs:\"\nawk '{print $7}' \"$log_file\" | sort | uniq -c | sort -rn | head -10\necho \"\"\necho \"HTTP Status Code Distribution:\"\nawk '{print $9}' \"$log_file\" | sort | uniq -c | sort -rn\n```\n\n### Phase 6: Network Scripts\n\n**Network Connectivity Checker**\n```bash\n#!\u002Fbin\u002Fbash\nhosts=(\"8.8.8.8\" \"1.1.1.1\" \"google.com\")\n\necho \"Network Connectivity Check\"\necho \"==========================\"\n\nfor host in \"${hosts[@]}\"; do\n    if ping -c 1 -W 2 \"$host\" &>\u002Fdev\u002Fnull; then\n        echo \"[UP] $host is reachable\"\n    else\n        echo \"[DOWN] $host is unreachable\"\n    fi\ndone\n```\n\n**Website Uptime Checker**\n```bash\n#!\u002Fbin\u002Fbash\nwebsites=(\"https:\u002F\u002Fgoogle.com\" \"https:\u002F\u002Fgithub.com\")\nlog_file=\"uptime_log.txt\"\n\necho \"Website Uptime Check - $(date)\" >> \"$log_file\"\n\nfor website in \"${websites[@]}\"; do\n    if curl --output \u002Fdev\u002Fnull --silent --head --fail --max-time 10 \"$website\"; then\n        echo \"[UP] $website is accessible\" | tee -a \"$log_file\"\n    else\n        echo \"[DOWN] $website is inaccessible\" | tee -a \"$log_file\"\n    fi\ndone\n```\n\n**Network Interface Info**\n```bash\n#!\u002Fbin\u002Fbash\ninterface=\"${1:-eth0}\"\n\necho \"Network Interface Information: $interface\"\necho \"=========================================\"\nip addr show \"$interface\" 2>\u002Fdev\u002Fnull || ifconfig \"$interface\" 2>\u002Fdev\u002Fnull\necho \"\"\necho \"Routing Table:\"\nip route | grep \"$interface\"\n```\n\n### Phase 7: Automation Scripts\n\n**Automated Package Installation**\n```bash\n#!\u002Fbin\u002Fbash\npackages=(\"vim\" \"htop\" \"curl\" \"wget\" \"git\")\n\necho \"Installing packages...\"\n\nfor package in \"${packages[@]}\"; do\n    if dpkg -l | grep -q \"^ii  $package\"; then\n        echo \"[SKIP] $package is already installed\"\n    else\n        sudo apt-get install -y \"$package\"\n        echo \"[INSTALLED] $package\"\n    fi\ndone\n\necho \"Package installation completed.\"\n```\n\n**Task Scheduler (Cron Setup)**\n```bash\n#!\u002Fbin\u002Fbash\nscheduled_task=\"\u002Fpath\u002Fto\u002Fyour_script.sh\"\nschedule_time=\"0 2 * * *\"  # Run at 2 AM daily\n\n# Add task to crontab\n(crontab -l 2>\u002Fdev\u002Fnull; echo \"$schedule_time $scheduled_task\") | crontab -\necho \"Task scheduled: $schedule_time $scheduled_task\"\n```\n\n**Service Restart Script**\n```bash\n#!\u002Fbin\u002Fbash\nservice_name=\"${1:-apache2}\"\n\n# Restart a specified service\nif systemctl is-active --quiet \"$service_name\"; then\n    echo \"Restarting $service_name...\"\n    sudo systemctl restart \"$service_name\"\n    echo \"Service $service_name restarted.\"\nelse\n    echo \"Service $service_name is not running. Starting...\"\n    sudo systemctl start \"$service_name\"\n    echo \"Service $service_name started.\"\nfi\n```\n\n### Phase 8: File Operations\n\n**Directory Synchronization**\n```bash\n#!\u002Fbin\u002Fbash\nsource_dir=\"\u002Fpath\u002Fto\u002Fsource\"\ndestination_dir=\"\u002Fpath\u002Fto\u002Fdestination\"\n\n# Synchronize directories using rsync\nrsync -avz --delete \"$source_dir\u002F\" \"$destination_dir\u002F\"\necho \"Directories synchronized successfully.\"\n```\n\n**Data Cleanup Script**\n```bash\n#!\u002Fbin\u002Fbash\ndirectory=\"${1:-\u002Ftmp}\"\ndays=\"${2:-7}\"\n\necho \"Cleaning files older than $days days in $directory\"\n\n# Remove files older than specified days\nfind \"$directory\" -type f -mtime +\"$days\" -exec rm -v {} \\;\necho \"Cleanup completed.\"\n```\n\n**Folder Size Checker**\n```bash\n#!\u002Fbin\u002Fbash\nfolder_path=\"${1:-.}\"\n\necho \"Folder Size Analysis: $folder_path\"\necho \"====================================\"\n\n# Display sizes of subdirectories sorted by size\ndu -sh \"$folder_path\"\u002F* 2>\u002Fdev\u002Fnull | sort -rh | head -20\necho \"\"\necho \"Total size:\"\ndu -sh \"$folder_path\"\n```\n\n### Phase 9: System Information\n\n**System Info Collector**\n```bash\n#!\u002Fbin\u002Fbash\noutput_file=\"system_info_$(hostname)_$(date +%Y%m%d).txt\"\n\n{\n    echo \"System Information Report\"\n    echo \"Generated: $(date)\"\n    echo \"=========================\"\n    echo \"\"\n    echo \"Hostname: $(hostname)\"\n    echo \"OS: $(uname -a)\"\n    echo \"\"\n    echo \"CPU Info:\"\n    lscpu | grep -E \"Model name|CPU\\(s\\)|Thread\"\n    echo \"\"\n    echo \"Memory:\"\n    free -h\n    echo \"\"\n    echo \"Disk Space:\"\n    df -h\n    echo \"\"\n    echo \"Network Interfaces:\"\n    ip -br addr\n    echo \"\"\n    echo \"Logged In Users:\"\n    who\n} > \"$output_file\"\n\necho \"System info saved to $output_file\"\n```\n\n### Phase 10: Git and Development\n\n**Git Repository Updater**\n```bash\n#!\u002Fbin\u002Fbash\ngit_repos=(\"\u002Fpath\u002Fto\u002Frepo1\" \"\u002Fpath\u002Fto\u002Frepo2\")\n\nfor repo in \"${git_repos[@]}\"; do\n    if [ -d \"$repo\u002F.git\" ]; then\n        echo \"Updating repository: $repo\"\n        cd \"$repo\"\n        git fetch --all\n        git pull origin \"$(git branch --show-current)\"\n        echo \"Updated: $repo\"\n    else\n        echo \"Not a git repository: $repo\"\n    fi\ndone\n\necho \"All repositories updated.\"\n```\n\n**Remote Script Execution**\n```bash\n#!\u002Fbin\u002Fbash\nremote_server=\"${1:-user@remote-server}\"\nremote_script=\"${2:-\u002Fpath\u002Fto\u002Fremote\u002Fscript.sh}\"\n\n# Execute a script on a remote server via SSH\nssh \"$remote_server\" \"bash -s\" \u003C \"$remote_script\"\necho \"Remote script executed on $remote_server\"\n```\n\n## Quick Reference\n\n### Common Script Patterns\n\n| Pattern | Purpose |\n|---------|---------|\n| `#!\u002Fbin\u002Fbash` | Shebang for bash |\n| `$(date +%Y%m%d)` | Date formatting |\n| `$((expression))` | Arithmetic |\n| `${var:-default}` | Default value |\n| `\"$@\"` | All arguments |\n\n### Useful Commands\n\n| Command | Purpose |\n|---------|---------|\n| `chmod +x script.sh` | Make executable |\n| `.\u002Fscript.sh` | Run script |\n| `nohup .\u002Fscript.sh &` | Run in background |\n| `crontab -e` | Edit cron jobs |\n| `source script.sh` | Run in current shell |\n\n### Cron Format\nMinute(0-59) Hour(0-23) Day(1-31) Month(1-12) Weekday(0-7, 0\u002F7=Sun)\n\n## Constraints and Limitations\n\n- Always test scripts in non-production first\n- Use absolute paths to avoid errors\n- Quote variables to handle spaces properly\n- Many scripts require root\u002Fsudo privileges\n- Use `bash -x script.sh` for debugging\n","# Linux Production Shell Scripts\n\n## Purpose\n\nProvide production-ready shell script templates for common Linux system administration tasks including backups, monitoring, user management, log analysis, and automation. These scripts serve as building blocks for security operations and penetration testing environments.\n\n## Prerequisites\n\n### Required Environment\n- Linux\u002FUnix system (bash shell)\n- Appropriate permissions for tasks\n- Required utilities installed (rsync, openssl, etc.)\n\n### Required Knowledge\n- Basic bash scripting\n- Linux file system structure\n- System administration concepts\n\n## Outputs and Deliverables\n\n1. **Backup Solutions** - Automated file and database backups\n2. **Monitoring Scripts** - Resource usage tracking\n3. **Automation Tools** - Scheduled task execution\n4. **Security Scripts** - Password management, encryption\n\n## Core Workflow\n\n### Phase 1: File Backup Scripts\n\n**Basic Directory Backup**\n```bash\n#!\u002Fbin\u002Fbash\nbackup_dir=\"\u002Fpath\u002Fto\u002Fbackup\"\nsource_dir=\"\u002Fpath\u002Fto\u002Fsource\"\n\n# Create a timestamped backup of the source directory\ntar -czf \"$backup_dir\u002Fbackup_$(date +%Y%m%d_%H%M%S).tar.gz\" \"$source_dir\"\necho \"Backup completed: backup_$(date +%Y%m%d_%H%M%S).tar.gz\"\n```\n\n**Remote Server Backup**\n```bash\n#!\u002Fbin\u002Fbash\nsource_dir=\"\u002Fpath\u002Fto\u002Fsource\"\nremote_server=\"user@remoteserver:\u002Fpath\u002Fto\u002Fbackup\"\n\n# Backup files\u002Fdirectories to a remote server using rsync\nrsync -avz --progress \"$source_dir\" \"$remote_server\"\necho \"Files backed up to remote server.\"\n```\n\n**Backup Rotation Script**\n```bash\n#!\u002Fbin\u002Fbash\nbackup_dir=\"\u002Fpath\u002Fto\u002Fbackups\"\nmax_backups=5\n\n# Rotate backups by deleting the oldest if more than max_backups\nwhile [ $(ls -1 \"$backup_dir\" | wc -l) -gt \"$max_backups\" ]; do\n    oldest_backup=$(ls -1t \"$backup_dir\" | tail -n 1)\n    rm -r \"$backup_dir\u002F$oldest_backup\"\n    echo \"Removed old backup: $oldest_backup\"\ndone\necho \"Backup rotation completed.\"\n```\n\n**Database Backup Script**\n```bash\n#!\u002Fbin\u002Fbash\ndatabase_name=\"your_database\"\ndb_user=\"username\"\ndb_pass=\"password\"\noutput_file=\"database_backup_$(date +%Y%m%d).sql\"\n\n# Perform database backup using mysqldump\nmysqldump -u \"$db_user\" -p\"$db_pass\" \"$database_name\" > \"$output_file\"\ngzip \"$output_file\"\necho \"Database backup created: $output_file.gz\"\n```\n\n### Phase 2: System Monitoring Scripts\n\n**CPU Usage Monitor**\n```bash\n#!\u002Fbin\u002Fbash\nthreshold=90\n\n# Monitor CPU usage and trigger alert if threshold exceeded\ncpu_usage=$(top -bn1 | grep \"Cpu(s)\" | awk '{print $2}' | cut -d. -f1)\n\nif [ \"$cpu_usage\" -gt \"$threshold\" ]; then\n    echo \"ALERT: High CPU usage detected: $cpu_usage%\"\n    # Add notification logic (email, slack, etc.)\n    # mail -s \"CPU Alert\" admin@example.com \u003C\u003C\u003C \"CPU usage: $cpu_usage%\"\nfi\n```\n\n**Disk Space Monitor**\n```bash\n#!\u002Fbin\u002Fbash\nthreshold=90\npartition=\"\u002Fdev\u002Fsda1\"\n\n# Monitor disk usage and trigger alert if threshold exceeded\ndisk_usage=$(df -h | grep \"$partition\" | awk '{print $5}' | cut -d% -f1)\n\nif [ \"$disk_usage\" -gt \"$threshold\" ]; then\n    echo \"ALERT: High disk usage detected: $disk_usage%\"\n    # Add alert\u002Fnotification logic here\nfi\n```\n\n**CPU Usage Logger**\n```bash\n#!\u002Fbin\u002Fbash\noutput_file=\"cpu_usage_log.txt\"\n\n# Log current CPU usage to a file with timestamp\ntimestamp=$(date '+%Y-%m-%d %H:%M:%S')\ncpu_usage=$(top -bn1 | grep 'Cpu(s)' | awk '{print $2}' | cut -d. -f1)\necho \"$timestamp - CPU Usage: $cpu_usage%\" >> \"$output_file\"\necho \"CPU usage logged.\"\n```\n\n**System Health Check**\n```bash\n#!\u002Fbin\u002Fbash\noutput_file=\"system_health_check.txt\"\n\n# Perform system health check and save results to a file\n{\n    echo \"System Health Check - $(date)\"\n    echo \"================================\"\n    echo \"\"\n    echo \"Uptime:\"\n    uptime\n    echo \"\"\n    echo \"Load Average:\"\n    cat \u002Fproc\u002Floadavg\n    echo \"\"\n    echo \"Memory Usage:\"\n    free -h\n    echo \"\"\n    echo \"Disk Usage:\"\n    df -h\n    echo \"\"\n    echo \"Top Processes:\"\n    ps aux --sort=-%cpu | head -10\n} > \"$output_file\"\n\necho \"System health check saved to $output_file\"\n```\n\n### Phase 3: User Management Scripts\n\n**User Account Creation**\n```bash\n#!\u002Fbin\u002Fbash\nusername=\"newuser\"\n\n# Check if user exists; if not, create new user\nif id \"$username\" &>\u002Fdev\u002Fnull; then\n    echo \"User $username already exists.\"\nelse\n    useradd -m -s \u002Fbin\u002Fbash \"$username\"\n    echo \"User $username created.\"\n    \n    # Set password interactively\n    passwd \"$username\"\nfi\n```\n\n**Password Expiry Checker**\n```bash\n#!\u002Fbin\u002Fbash\noutput_file=\"password_expiry_report.txt\"\n\n# Check password expiry for users with bash shell\necho \"Password Expiry Report - $(date)\" > \"$output_file\"\necho \"=================================\" >> \"$output_file\"\n\nIFS=$'\\n'\nfor user in $(grep \"\u002Fbin\u002Fbash\" \u002Fetc\u002Fpasswd | cut -d: -f1); do\n    password_expires=$(chage -l \"$user\" 2>\u002Fdev\u002Fnull | grep \"Password expires\" | awk -F: '{print $2}')\n    echo \"User: $user - Password Expires: $password_expires\" >> \"$output_file\"\ndone\nunset IFS\n\necho \"Password expiry report saved to $output_file\"\n```\n\n### Phase 4: Security Scripts\n\n**Password Generator**\n```bash\n#!\u002Fbin\u002Fbash\nlength=${1:-16}\n\n# Generate a random password\npassword=$(openssl rand -base64 48 | tr -dc 'a-zA-Z0-9!@#$%^&*' | head -c\"$length\")\necho \"Generated password: $password\"\n```\n\n**File Encryption Script**\n```bash\n#!\u002Fbin\u002Fbash\nfile=\"$1\"\naction=\"${2:-encrypt}\"\n\nif [ -z \"$file\" ]; then\n    echo \"Usage: $0 \u003Cfile> [encrypt|decrypt]\"\n    exit 1\nfi\n\nif [ \"$action\" == \"encrypt\" ]; then\n    # Encrypt file using AES-256-CBC\n    openssl enc -aes-256-cbc -salt -pbkdf2 -in \"$file\" -out \"$file.enc\"\n    echo \"File encrypted: $file.enc\"\nelif [ \"$action\" == \"decrypt\" ]; then\n    # Decrypt file\n    output_file=\"${file%.enc}\"\n    openssl enc -aes-256-cbc -d -pbkdf2 -in \"$file\" -out \"$output_file\"\n    echo \"File decrypted: $output_file\"\nfi\n```\n\n### Phase 5: Log Analysis Scripts\n\n**Error Log Extractor**\n```bash\n#!\u002Fbin\u002Fbash\nlogfile=\"${1:-\u002Fvar\u002Flog\u002Fsyslog}\"\noutput_file=\"error_log_$(date +%Y%m%d).txt\"\n\n# Extract lines with \"ERROR\" from the log file\ngrep -i \"error\\|fail\\|critical\" \"$logfile\" > \"$output_file\"\necho \"Error log created: $output_file\"\necho \"Total errors found: $(wc -l \u003C \"$output_file\")\"\n```\n\n**Web Server Log Analyzer**\n```bash\n#!\u002Fbin\u002Fbash\nlog_file=\"${1:-\u002Fvar\u002Flog\u002Fapache2\u002Faccess.log}\"\n\necho \"Web Server Log Analysis\"\necho \"========================\"\necho \"\"\necho \"Top 10 IP Addresses:\"\nawk '{print $1}' \"$log_file\" | sort | uniq -c | sort -rn | head -10\necho \"\"\necho \"Top 10 Requested URLs:\"\nawk '{print $7}' \"$log_file\" | sort | uniq -c | sort -rn | head -10\necho \"\"\necho \"HTTP Status Code Distribution:\"\nawk '{print $9}' \"$log_file\" | sort | uniq -c | sort -rn\n```\n\n### Phase 6: Network Scripts\n\n**Network Connectivity Checker**\n```bash\n#!\u002Fbin\u002Fbash\nhosts=(\"8.8.8.8\" \"1.1.1.1\" \"google.com\")\n\necho \"Network Connectivity Check\"\necho \"==========================\"\n\nfor host in \"${hosts[@]}\"; do\n    if ping -c 1 -W 2 \"$host\" &>\u002Fdev\u002Fnull; then\n        echo \"[UP] $host is reachable\"\n    else\n        echo \"[DOWN] $host is unreachable\"\n    fi\ndone\n```\n\n**Website Uptime Checker**\n```bash\n#!\u002Fbin\u002Fbash\nwebsites=(\"https:\u002F\u002Fgoogle.com\" \"https:\u002F\u002Fgithub.com\")\nlog_file=\"uptime_log.txt\"\n\necho \"Website Uptime Check - $(date)\" >> \"$log_file\"\n\nfor website in \"${websites[@]}\"; do\n    if curl --output \u002Fdev\u002Fnull --silent --head --fail --max-time 10 \"$website\"; then\n        echo \"[UP] $website is accessible\" | tee -a \"$log_file\"\n    else\n        echo \"[DOWN] $website is inaccessible\" | tee -a \"$log_file\"\n    fi\ndone\n```\n\n**Network Interface Info**\n```bash\n#!\u002Fbin\u002Fbash\ninterface=\"${1:-eth0}\"\n\necho \"Network Interface Information: $interface\"\necho \"=========================================\"\nip addr show \"$interface\" 2>\u002Fdev\u002Fnull || ifconfig \"$interface\" 2>\u002Fdev\u002Fnull\necho \"\"\necho \"Routing Table:\"\nip route | grep \"$interface\"\n```\n\n### Phase 7: Automation Scripts\n\n**Automated Package Installation**\n```bash\n#!\u002Fbin\u002Fbash\npackages=(\"vim\" \"htop\" \"curl\" \"wget\" \"git\")\n\necho \"Installing packages...\"\n\nfor package in \"${packages[@]}\"; do\n    if dpkg -l | grep -q \"^ii  $package\"; then\n        echo \"[SKIP] $package is already installed\"\n    else\n        sudo apt-get install -y \"$package\"\n        echo \"[INSTALLED] $package\"\n    fi\ndone\n\necho \"Package installation completed.\"\n```\n\n**Task Scheduler (Cron Setup)**\n```bash\n#!\u002Fbin\u002Fbash\nscheduled_task=\"\u002Fpath\u002Fto\u002Fyour_script.sh\"\nschedule_time=\"0 2 * * *\"  # Run at 2 AM daily\n\n# Add task to crontab\n(crontab -l 2>\u002Fdev\u002Fnull; echo \"$schedule_time $scheduled_task\") | crontab -\necho \"Task scheduled: $schedule_time $scheduled_task\"\n```\n\n**Service Restart Script**\n```bash\n#!\u002Fbin\u002Fbash\nservice_name=\"${1:-apache2}\"\n\n# Restart a specified service\nif systemctl is-active --quiet \"$service_name\"; then\n    echo \"Restarting $service_name...\"\n    sudo systemctl restart \"$service_name\"\n    echo \"Service $service_name restarted.\"\nelse\n    echo \"Service $service_name is not running. Starting...\"\n    sudo systemctl start \"$service_name\"\n    echo \"Service $service_name started.\"\nfi\n```\n\n### Phase 8: File Operations\n\n**Directory Synchronization**\n```bash\n#!\u002Fbin\u002Fbash\nsource_dir=\"\u002Fpath\u002Fto\u002Fsource\"\ndestination_dir=\"\u002Fpath\u002Fto\u002Fdestination\"\n\n# Synchronize directories using rsync\nrsync -avz --delete \"$source_dir\u002F\" \"$destination_dir\u002F\"\necho \"Directories synchronized successfully.\"\n```\n\n**Data Cleanup Script**\n```bash\n#!\u002Fbin\u002Fbash\ndirectory=\"${1:-\u002Ftmp}\"\ndays=\"${2:-7}\"\n\necho \"Cleaning files older than $days days in $directory\"\n\n# Remove files older than specified days\nfind \"$directory\" -type f -mtime +\"$days\" -exec rm -v {} \\;\necho \"Cleanup completed.\"\n```\n\n**Folder Size Checker**\n```bash\n#!\u002Fbin\u002Fbash\nfolder_path=\"${1:-.}\"\n\necho \"Folder Size Analysis: $folder_path\"\necho \"====================================\"\n\n# Display sizes of subdirectories sorted by size\ndu -sh \"$folder_path\"\u002F* 2>\u002Fdev\u002Fnull | sort -rh | head -20\necho \"\"\necho \"Total size:\"\ndu -sh \"$folder_path\"\n```\n\n### Phase 9: System Information\n\n**System Info Collector**\n```bash\n#!\u002Fbin\u002Fbash\noutput_file=\"system_info_$(hostname)_$(date +%Y%m%d).txt\"\n\n{\n    echo \"System Information Report\"\n    echo \"Generated: $(date)\"\n    echo \"=========================\"\n    echo \"\"\n    echo \"Hostname: $(hostname)\"\n    echo \"OS: $(uname -a)\"\n    echo \"\"\n    echo \"CPU Info:\"\n    lscpu | grep -E \"Model name|CPU\\(s\\)|Thread\"\n    echo \"\"\n    echo \"Memory:\"\n    free -h\n    echo \"\"\n    echo \"Disk Space:\"\n    df -h\n    echo \"\"\n    echo \"Network Interfaces:\"\n    ip -br addr\n    echo \"\"\n    echo \"Logged In Users:\"\n    who\n} > \"$output_file\"\n\necho \"System info saved to $output_file\"\n```\n\n### Phase 10: Git and Development\n\n**Git Repository Updater**\n```bash\n#!\u002Fbin\u002Fbash\ngit_repos=(\"\u002Fpath\u002Fto\u002Frepo1\" \"\u002Fpath\u002Fto\u002Frepo2\")\n\nfor repo in \"${git_repos[@]}\"; do\n    if [ -d \"$repo\u002F.git\" ]; then\n        echo \"Updating repository: $repo\"\n        cd \"$repo\"\n        git fetch --all\n        git pull origin \"$(git branch --show-current)\"\n        echo \"Updated: $repo\"\n    else\n        echo \"Not a git repository: $repo\"\n    fi\ndone\n\necho \"All repositories updated.\"\n```\n\n**Remote Script Execution**\n```bash\n#!\u002Fbin\u002Fbash\nremote_server=\"${1:-user@remote-server}\"\nremote_script=\"${2:-\u002Fpath\u002Fto\u002Fremote\u002Fscript.sh}\"\n\n# Execute a script on a remote server via SSH\nssh \"$remote_server\" \"bash -s\" \u003C \"$remote_script\"\necho \"Remote script executed on $remote_server\"\n```\n\n## Quick Reference\n\n### Common Script Patterns\n\n| Pattern | Purpose |\n|---------|---------|\n| `#!\u002Fbin\u002Fbash` | Shebang for bash |\n| `$(date +%Y%m%d)` | Date formatting |\n| `$((expression))` | Arithmetic |\n| `${var:-default}` | Default value |\n| `\"$@\"` | All arguments |\n\n### Useful Commands\n\n| Command | Purpose |\n|---------|---------|\n| `chmod +x script.sh` | Make executable |\n| `.\u002Fscript.sh` | Run script |\n| `nohup .\u002Fscript.sh &` | Run in background |\n| `crontab -e` | Edit cron jobs |\n| `source script.sh` | Run in current shell |\n\n### Cron Format\nMinute(0-59) Hour(0-23) Day(1-31) Month(1-12) Weekday(0-7, 0\u002F7=Sun)\n\n## Constraints and Limitations\n\n- Always test scripts in non-production first\n- Use absolute paths to avoid errors\n- Quote variables to handle spaces properly\n- Many scripts require root\u002Fsudo privileges\n- Use `bash -x script.sh` for debugging\n",{"name":5,"metadata":23,"description":7},{"author":24,"version":25},"zebbern","1.1","main","e3744adb7654df443f12927f3e001252b3a26b6d","cli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Flinux-shell-scripting","https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates","https:\u002F\u002Fgithub.com\u002FKrismithReddy12","2026-07-29 08:15:10",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add KrismithReddy12\u002Fclaude-code-templates --skill \"Linux Production Shell Scripts\"",{"tool":38,"command":39},"bunx","bunx skills add KrismithReddy12\u002Fclaude-code-templates --skill \"Linux Production Shell Scripts\"",{"tool":41,"command":42},"pnpm","pnpm dlx skills add KrismithReddy12\u002Fclaude-code-templates --skill \"Linux Production Shell Scripts\"","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fdevelopment\u002Flinux-shell-scripting\u002FSKILL.md",true,[],[47,54,63,70,77,84],{"skillNo":48,"name":49,"nameZh":6,"description":50,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":51,"categories":52,"keywords":53,"publishedAt":18},"01M79YMXJ07S2BQVB7JAM3657Q","zapier-make-patterns","No-code automation democratizes workflow building. Zapier and Make (formerly Integromat) let non-developers automate business processes without writing code. But no-code doesn't mean no-complexity - these platforms have their own patterns, pitfalls, and breaking points.  This skill covers when to use which platform, how to build reliable automations, and when to graduate to code-based solutions. Key insight: Zapier optimizes for simplicity and integrations (7000+ apps), Make optimizes for power","https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fzapier-make-patterns\u002FSKILL.md",[],[],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":58,"licenseFileUrl":59,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":18},"01M79YMVPMK3Y4JDP2KDJKQ2ZD","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":18},"01M79YMMQ4XXMPJHDQHY8FR7ME","workflow-automation","Workflow automation is the infrastructure that makes AI agents reliable. Without durable execution, a network hiccup during a 10-step payment flow means lost money and angry customers. With it, workflows resume exactly where they left off.  This skill covers the platforms (n8n, Temporal, Inngest) and patterns (sequential, parallel, orchestrator-worker) that turn brittle scripts into production-grade automation.  Key insight: The platforms make different tradeoffs. n8n optimizes for accessibility","https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fworkflow-automation\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":18},"01M79YMHQY3CP1XXMQ00TGQFAW","trigger-dev","Trigger.dev expert for background jobs, AI workflows, and reliable async execution with excellent developer experience and TypeScript-first design. Use when: trigger.dev, trigger dev, background task, ai background job, long running task.","https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Ftrigger-dev\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":18},"01M79YME4Z3DRW0MT6BNYW1D7P","slack-automation","Automate Slack workspace operations including messaging, search, channel management, and reaction workflows through Composio's Slack toolkit.","https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fslack-automation\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":18},"01M79YMAX7NFYDFXFZH2TJS7SS","planning-with-files","Transforms workflow to use Manus-style persistent markdown files for planning, progress tracking, and knowledge storage. Use when starting complex tasks, multi-step projects, research tasks, or when the user mentions planning, organizing work, tracking progress, or wants structured output.","https:\u002F\u002Fgithub.com\u002FKrismithReddy12\u002Fclaude-code-templates\u002Fblob\u002Fmain\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fworkflow-automation\u002Fplanning-with-files\u002FSKILL.md",[],[]]