Understanding cron syntax
Cron has scheduled recurring tasks on Unix systems for decades. Its syntax fits on a single line of five fields, but that brevity makes it easy to misread. Here's how to decode it with confidence.
The five fields
In order: minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-6, Sunday = 0). An asterisk * means "every value". So 0 9 * * 1 reads: minute 0, hour 9, every day of the month, every month, on Monday - that is, "every Monday at 9:00".
💡 Anecdote - A small inherited quirk: in most crons, Sunday can be written as either 0 or 7.
The shortcuts that matter
*/15in the minute field: every 15 minutes0 0 * * *: every day at midnight0 8-18 * * 1-5: every hour on the hour from 8am to 6pm, Monday to Friday0 3 1 * *: the 1st of each month at 3am
The classic traps
The timezone is the server's, not yours: a task "at midnight" may land in broad daylight elsewhere. And when day-of-month and day-of-week are both set, cron fires if either one matches, not both - a frequent source of bugs. When in doubt, write your line then read it back in plain words with our cron parser, which turns each field into an understandable sentence
🤓 Did you know? The name "cron" comes from the Greek chronos, time. The most widespread version today, "Vixie cron," was written by Paul Vixie in 1987.