Stop cron from sending you garbage emails you never asked for
Cron & Task Scheduling (Cron/Systemd Timers/At)
Stop cron from sending you garbage emails you never asked for
🧩 The Challenge
Setting up a quick cron job is easy, but then your root mailbox starts filling up with useless “output” every single minute. I’ve spent way too much time clearing out thousands of tiny mail files that just say the script ran fine.
💡 The Fix
Just redirect both standard output and standard error to /dev/null so the cron daemon has nothing to pipe into your local mail spool. It’s the cleanest way to keep your system logs from becoming a trash heap.
* * * * * /usr/local/bin/backup-script.sh > /dev/null 2>&1
⚙️ Why It Works
Redirecting the output to /dev/null kills the noise, and the 2>&1 bit makes sure your error messages don’t sneak through to the mailer anyway. Cron only triggers a mail notification if it sees output being generated, so this effectively silences the messenger.
🚀 Pro-Tip: If you actually need to log errors, pipe the output to a dedicated log file instead of nuking it.
Linux Tips & Tricks | © ngelinux.com | 8/11/2026
