File & Directory Automation
$ find /var/log -type f -name ".log" -mtime +7 -delete $ tar -czf logs_$(date +%F).tar.gz /var/log/.log $ rsync -avz /local/path/ user@remote:/backup/ $ for f in *.txt; do mv "$f" "${f%.txt}.bak"; done
System & Process Automation
$ systemctl is-active nginx || systemctl restart nginx $ sudo apt update -y && sudo apt upgrade -y $ free -m | awk '/Mem:/ {if ($4 < 100) system("sudo reboot")}'
Networking Automation
$ for h in host1 host2 host3; do ping -c1 $h && echo "$h OK" || echo " DOWN"; done $ curl -Is https:// example dot com | head -1 $ ping -c2 8 dot 8 dot 8 dot 8 || systemctl restart network
Security & Credential Automation
$ ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_rsa -N "" $ ssh-copy-id user@host $ grep "Failed password" /var/log/auth.log | awk '{print $11}' | sort | uniq -c | sort -nr
DevOps & CI/CD Automation
$ git clone https://repo.git && cd repo && . build dot sh $ docker system prune -af $ kubectl get pods -A | grep -v Running $ kubectl rollout restart deployment myapp -n prod
Monitoring & Alerts
$ df -h | awk 'NR>1 && $5+0>90 {print