Disk Space Warning Script
Copy a disk space warning bash script using df, thresholds, cron, and email alerts. Monitor Linux se...
Full guide →45 copy-paste bash scripts with plain-English explanations. ShellCheck-clean.
Copy a disk space warning bash script using df, thresholds, cron, and email alerts. Monitor Linux se...
Full guide →A deleted file on Linux has no undo. This bash backup script timestamps every cp -r run with a date...
Full guide →Guessing server state mid-outage costs time. One bash script reports hostname, uptime, CPU load, RAM...
Full guide →Opening files one by one to find a string wastes time. grep -rn searches every file under a director...
Full guide →Learning a site is down from a user complaint means the outage already cost you. A bash curl check t...
Full guide →The wrong comparison operator makes a bash if statement fail silently on unexpected input. if/else,...
Full guide →Backup folders without dates overwrite old runs and sort unpredictably. date +%Y-%m-%d names each fo...
Full guide →Disk at 100% and the server stopped. Find the biggest files and directories fast with du and find, s...
Full guide →EADDRINUSE means something already holds your port. Find the process with lsof or ss and kill it saf...
Full guide →A bash script that maps every port your server is listening on, along with the process name holding...
Full guide →A bash script that removes stopped containers, unused images, dangling volumes, and build cache from...
Full guide →A for loop over ls output splits filenames with spaces and skips files silently. Loop over a glob, r...
Full guide →Find and replace text in files with sed: in-place edits, GNU vs macOS -i, word boundaries, capture g...
Full guide →A firewall rule built on the wrong IP locks you out. Find your local, public, gateway, DNS, and MAC...
Full guide →A variable you never exported is invisible to child processes, so the deploy reads an empty token an...
Full guide →Unmanaged logs fill /var/log until writes fail and services crash. find -mtime deletes .log files ol...
Full guide →Bash keeps going after a failed command, so a broken cd followed by rm -rf hits the wrong directory....
Full guide →ps, grep, copy the PID, kill: four steps every time. pkill stops a process by name in one command, a...
Full guide →A world-writable file on a web server lets a compromised script overwrite your app. Audit permission...
Full guide →A runaway process at 100% CPU goes unnoticed until the server stops responding. Measure CPU and RAM...
Full guide →A monitoring script with no email alert fails silently until users notice. A reusable bash alert fun...
Full guide →A mistaken DROP TABLE has no undo. Back up MySQL nightly with mysqldump and gzip, rotate dumps older...
Full guide →Password SSH on an internet-facing server invites brute-force attempts. A bash script runs ssh-keyge...
Full guide →Duplicate files pile up in archives and downloads and waste gigabytes. md5sum hashes every file and...
Full guide →A crashed nginx or PostgreSQL stays down for hours with no watchdog. A cron script uses systemctl is...
Full guide →A local-only backup dies with the machine. Push an incremental, resumable copy to a remote server wi...
Full guide →A bash script that connects to any domain over TLS, reads the certificate, and tells you how many da...
Full guide →A while-read loop dropped the last server in a list: the file had no final newline. Read files line...
Full guide →A function reused 'target' without local, overwrote the caller's variable, and cleanup deleted the w...
Full guide →return in a bash function sets an exit code, not a string. Return data with echo and command substit...
Full guide →A list stored as a space-separated string splits once an item has a space. Bash arrays fix it: index...
Full guide →A script that reads $1 as a value takes --env as that value and deploys nowhere. Parse arguments wit...
Full guide →cut -d/ -f3 returns the wrong slice once a URL gains https. Bash parameter expansion: substrings, pr...
Full guide →A long cron job overlaps its next run and stacks copies until the box falls over. flock locks it to...
Full guide →A hung cron job never exits, never frees its lock, and quietly stops the job running. Bound a comman...
Full guide →A deploy that dies on the first transient error costs a night of manual re-runs. Retry with exponent...
Full guide →Plain curl exits 0 on an HTTP 500 and poisons everything downstream. A bash curl wrapper that checks...
Full guide →Read fields from a JSON API response with jq, and the three things (-r, // defaults, -e) that keep t...
Full guide →Post failure alerts to Slack from bash with curl, a jq-built payload and an ERR trap, so a broken ba...
Full guide →A script that dies mid-run leaves temp files and half-written output behind. trap on EXIT with mktem...
Full guide →An ssh loop that ignores exit codes reports done while three hosts never changed. Run one command or...
Full guide →A bash script that snapshots every listening TCP and UDP socket as CSV, diffs it against the previou...
Full guide →A cron bash watchdog for systemd units: restarts a stopped service, probes a hung one, bounds start-...
Full guide →A logrotate alternative for directories it does not own: keep the newest N dated folders, delete the...
Full guide →Every script re-invents strict mode, ERR traps, temp cleanup and a lock, or forgets one. Source ten...
Full guide →Free Interactive Tools
Need a cron expression? chmod calculator?
12 browser-based bash tools — no install required
An operational script system + a 30-function shared library + a 52-page field guide. The production layer the free snippets don't cover.
Get the Toolkit →