Cron and systemd timers are the two dominant task-scheduling mechanisms on Linux systems, covering everything from simple hourly scripts to complex dependency-aware background jobs. Cron has been the standard for decades and works on virtually every Unix-like system with a minimal learning curve, while systemd timers integrate tightly with the systemd ecosystem to provide structured logging, dependency ordering, and reliable catch-up on missed runs. The critical mental model to carry into both tools: they run in minimal, non-interactive environments with restricted PATH and no shell profile loaded — the most common source of "works in terminal, breaks in cron" failures.
What This Cheat Sheet Covers
This topic spans 17 focused tables and 140 indexed concepts. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
Table 1: Cron Field Syntax
The five-field crontab time expression is the foundation of every cron job. Each field position controls a distinct time unit, and understanding how they combine — including wildcards, ranges, lists, and step values — lets you express any recurring schedule in a single compact line.
| Command | Example | Description |
|---|---|---|
# MIN HOUR DOM MON DOW CMD | Five fields in order: minute (0–59), hour (0–23), day-of-month (1–31), month (1–12), day-of-week (0–7, 0 and 7 = Sunday). | |
* * * * * /path/to/cmd | • Matches every valid value for that field • * in minute means every minute | |
0 3 * * * /usr/bin/backup.sh | • Runs once at 3:00 AM every day • only exact match triggers the job | |
0 8,12,18 * * * /script.sh | Runs at 8 AM, 12 PM, and 6 PM — comma separates a list of values within one field. | |
0 9-17 * * 1-5 /script.sh | • Runs at the top of every hour from 9 AM to 5 PM, Monday through Friday • hyphen defines a contiguous range. |