How to Read Cron Expressions in Five Minutes

Cron looks like line noise until you learn one thing: it is five (or six) small numbers read left to right. After that, every expression is just a sentence.

The five fields

A standard Unix cron expression is five space-separated fields:

┌───────────── minute        (0–59)
│ ┌───────────── hour       (0–23)
│ │ ┌───────────── day of month (1–31)
│ │ │ ┌───────────── month     (1–12, or JAN–DEC)
│ │ │ │ ┌───────────── day of week  (0–7, or SUN–SAT; 0 and 7 are both Sunday)
│ │ │ │ │
* * * * *

Read it as a sentence: "when the minute is this, and the hour is that, and the day is..." — a job runs when all five fields match the current time. An asterisk means "any value", i.e. "don't care".

The four special characters

They combine: 0-30/10 means "in the range 0–30, every 10th value" — that's 0, 10, 20, 30, and not 40 or 50. Steps always start from the beginning of the range, not from "wherever you'd like".

Three real examples, decoded

0 9 * * 1-5 — "at minute 0, hour 9, any day of the month, any month, Monday through Friday." Weekdays at 09:00. The most common cron in production, ever.

*/15 * * * * — "every 15th minute of every hour." Note what this is not: it is not "every 15 minutes starting from whenever the job was deployed". Steps anchor to the top of the range — 0, 15, 30, 45 — no matter when the scheduler started.

30 4 1 * * — "04:30 on the first day of every month." Month-end jobs can't be written this way (there is no "last day" in plain cron — day 31 simply doesn't match in shorter months), which is why "run on the 1st" is the standard workaround for monthly jobs.

The trap that bites everyone once

Suppose you want "the 15th of every month, but only if it's a Tuesday". You write:

0 0 15 * 2

And the job runs on every 15th and every Tuesday. In standard (Vixie) cron, when both the day-of-month and day-of-week fields are restricted, they are combined with OR, not AND. If either field is *, the other one works as expected — the trap only appears when both are restricted.

"Day 15 and Tuesday" cannot be expressed in plain cron. In practice you schedule for the 15th and check the weekday inside the job itself.

Quirks worth knowing before they cost you an hour

Reading checklist

When you face an unfamiliar expression, work through it in this order: count the fields (5 or 6?), then read each field left to right and say the sentence out loud. Nine times out of ten, the field count is where the misunderstanding starts.