Cron Expression Examples — 26 Real Schedules, Decoded
26 crontab examples decoded field by field — daily, hourly, weekdays, first-of-month, steps, lists — plus six expressions that look right but aren't.
The fastest way to learn cron is to read real lines until the pattern clicks. Twenty-six of them below, grouped by what they do — every one decoded the same way the calculator reads it: minute, hour, day-of-month, month, day-of-week.
Everyday workhorses
| expression | meaning |
|---|---|
* * * * * |
every minute — 1,440 runs/day |
*/5 * * * * |
every 5 minutes, at :00 :05 … :55 (deep dive) |
*/15 * * * * |
every 15 minutes — :00 :15 :30 :45 |
0 * * * * |
hourly, at :00 — same as @hourly |
30 * * * * |
hourly, at :30 past |
0 0 * * * |
daily at 00:00 — same as @daily (full decode) |
30 3 * * * |
daily at 03:30 — the classic backup slot |
0 9,21 * * * |
twice daily, 09:00 and 21:00 |
0 0 * * 0 |
weekly, Sunday 00:00 — same as @weekly |
0 0 1 * * |
monthly, 1st at 00:00 — same as @monthly |
0 0 1 1 * |
yearly, Jan 1 00:00 — same as @yearly |
0 0 1 1,4,7,10 * |
quarterly — 1st of Jan, Apr, Jul, Oct |
Working-hours shapes
| expression | meaning |
|---|---|
0 9 * * 1-5 |
09:00 Monday–Friday |
0 9-17 * * 1-5 |
top of every hour, 09:00–17:00, weekdays |
*/30 9-17 * * 1-5 |
every 30 min, 09:00–17:30, weekdays |
*/10 8-18 * * * |
every 10 min, 08:00–18:50, every day |
0 10 * * 6,0 |
10:00 on weekends (Sat and Sun) |
0 22 * * 5 |
22:00 Friday — the deploy window |
45 23 * * 6 |
23:45 Saturday |
0 0 * * 1-5 |
midnight, weeknights only |
Calendar positions
| expression | meaning |
|---|---|
15 3 2 * * |
03:15 on the 2nd of each month |
0 12 15 * * |
12:00 on the 15th — mid-month checkpoint |
0 0 1,15 * * |
1st and 15th, midnight — the semi-monthly split |
0 0 29 2 * |
Feb 29 only — leap years (with the 2100 eight-year gap) |
0 8 * * mon,wed,fri |
08:00 Mon, Wed, Fri — names work everywhere numbers do |
0 0 * mar-jun fri |
midnight Fridays, March–June only |
The six that look right but aren’t
These parse cleanly and still do the wrong thing — this is where a next-run preview earns its keep.
0 9 1-7 * 1 — “first Monday of the month”? No. Both day fields restricted means OR: it fires on days 1–7 and every Monday — roughly ten runs a month. Real AND needs a guard in the command: 0 9 1-7 * * [ "$(date +\%u)" -eq 1 ] && cmd (and the % must be escaped). The OR trap has the full story.
* 0 * * * — “midnight”? No. Minute *, hour 0 = every minute from 00:00 to 00:59 — sixty runs. Midnight is 0 0 * * *; the * is the difference between “minute zero” and “every minute”.
5 * * * * — “every 5 minutes”? No. That’s */5. Without the slash it’s hourly at :05 — 24 runs a day, not 288.
* */5 * * * — “every 5 hours”? No. Hours {0,5,10,15,20} with minute * = every minute of those hours — 300 bursts a day. One shot per stepped hour is 0 */5 * * *.
0 0 31 * * — “monthly on the 31st”? Sort of. It fires in the seven 31-day months and silently skips Feb, Apr, Jun, Sep and Nov — no error, no log. If month-ends matter, use 28-31 plus a date -d tomorrow guard to catch the last real day.
*/7 * * * * — “every 7 minutes”? Mostly. It expands to {0,7,…,56}, then the next hour restarts at :00 — so one interval per hour is only 4 minutes. Steps that don’t divide 60 always leave a shorter tail gap.
Reading method in one line
Minute, hour, then the day rule: if both day fields are * it’s daily; if exactly one is restricted it alone decides; if both are restricted they OR — the one rule everyone gets wrong. Names and ? fit anywhere in their fields, steps count from the range start, and day-of-month values that don’t exist in a month are skipped without a log line.
Paste any line above into the calculator and watch the next-runs list make it concrete; when a job still doesn’t fire on the real box, debugging cron is the checklist — and when the schedule outgrows five fields entirely, systemd timers are the next grammar to learn.
Frequently asked questions
What is the cron expression for every day at midnight?
0 0 * * * — minute 0, hour 0, every day. Same thing as the @daily and @midnight shortcuts. It runs at 00:00 in the server's timezone, not yours.
What does * * * * * mean?
Every minute of every hour of every day — 1,440 runs a day. All five fields at * means nothing is restricted, so cron fires at every minute boundary.
How do I write 'first Monday of the month'?
Not with 0 9 1-7 * 1 — that's the OR trap: it fires on days 1–7 and every Monday. Real first-Monday needs a guard: 0 9 1-7 * * [ "$(date +\%u)" -eq 1 ] && cmd. Explained in the dom/dow trap.
What's the cron for every 30 minutes during business hours?
*/30 9-17 * * 1-5 — minutes {0,30} inside hours 9–17, Monday through Friday. Last run of the day is 17:30, not 17:59 — the hour field gates which hours play, the step fills them.
How do I schedule quarterly jobs?
0 0 1 1,4,7,10 * — midnight on the 1st of Jan, Apr, Jul, Oct. The month field takes a comma list; quarter-ends like 31 3,6,9,12 need care because Sep/Jun have 30 days — 31 is silently skipped there.
Is 0 0 * * 0 Sunday or Monday?
Sunday. Day-of-week numbers run 0=Sunday through 6=Saturday, and 7 is accepted as a second Sunday. 1 is Monday — so 1-5 is the weekday span and 0,6 is the weekend.