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, 112 flashcards. Below is a complete table-by-table outline of this topic, spanning foundational concepts through advanced details.
A jump-to index of every table row in this cheat sheet.
An interactive map of every table and concept in this topic.
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. | ||
*/15 * * * * /check.sh | • Runs every 15 minutes • */N means every N units of that field | ||
0 6-18/2 * * * /script.sh | • Runs every 2 hours between 6 AM and 6 PM • slash applies a step within a range. | ||
0 0 * * 0 | • Both 0 and 7 represent Sunday in most cron implementations• use 0 for safest portability | ||
30 4 1,15 * 5 | Runs at 4:30 AM on the 1st and 15th of every month, plus every Friday — when both DOM and DOW are set, either condition triggers the job. | ||
crontab.guru | • Web tool for interactively building and validating cron expressions • shows next scheduled run |