Cron + Crontab Cheat Sheet — Quick Reference Guide
Everything you need to know about cron syntax, crontab files, systemd timers, and scheduling jobs on Linux. Keep this page bookmarked — you'll need it every time you set up a cron job.
Quick Troubleshooting
systemctl status cron2. Verify the script has execute permission:
chmod +x /path/to/script3. Check cron logs:
grep CRON /var/log/syslog4. Make sure there's a newline at the end of your crontab
5. Check
MAILTO is set to receive error emails
date or timedatectl.Ensure the system timezone is correct:
sudo timedatectl set-timezone America/New_YorkOr set
CRON_TZ in your crontab for per-user timezone override.
Frequently Asked Questions
A cron expression is a string of five or six fields that defines a schedule for running commands or scripts automatically on Linux and Unix systems. The five standard fields represent minute, hour, day-of-month, month, and day-of-week. Each field can contain specific values, ranges (1-5), lists (1,3,5), or wildcards (*) to create flexible scheduling patterns.
To run a task every 5 minutes, use the cron expression */5 * * * *. The */5 in the minute field means "every 5 minutes" starting from minute 0. This will execute at :00, :05, :10, :15, :20, :25, :30, :35, :40, :45, :50, and :55 past every hour.
The most common causes are: (1) The server timezone is not what you expect — cron uses the system's local timezone, not UTC. Check with date or timedatectl. (2) The script doesn't have execute permission — run chmod +x /path/to/script. (3) Environment variables differ from your interactive shell — cron has a minimal PATH. (4) There's no newline at the end of your crontab file.
Use the day-of-week field (the 5th field) with values 0-7 where 0 and 7 represent Sunday, 1 is Monday through 6 is Saturday. For example, 0 9 * * 1-5 runs at 9:00 AM Monday through Friday only. You can also use comma-separated values like 0 9 * * 1,3,5 for Monday, Wednesday, and Friday.
Both schedule recurring tasks, but systemd timers are the modern replacement on Linux. Systemd timers offer better logging via journalctl, dependency management, persistent missed runs, and finer-grained scheduling. Cron is simpler and more widely known. For new deployments, systemd timers are recommended; cron remains excellent for straightforward scheduling.
Use Cases
Quick Syntax Reference
Keep this cheat sheet bookmarked as a quick cron syntax reference whenever you need to set up or modify scheduled tasks on Linux servers.
Special Character Reference
Understand cron special characters like asterisk, comma, hyphen, and slash to build complex scheduling patterns with confidence.
Complex Pattern Building
Build complex cron scheduling patterns by combining multiple examples and adjusting them to fit your specific task automation requirements.
Cron Job Debugging
Debug cron job timing issues by referencing common patterns and understanding timezone behavior, escape characters, and output redirection.
DevOps Learning
Learn cron for DevOps tasks including systemd timer conversion, crontab management, environment variables, and log rotation best practices.