Unix Cron
Unix cron is the original 5-field cron format used by `crontab` on Linux and macOS, and the basis for nearly every other dialect. Five fields control the schedule: minute, hour, day of month, month, and day of week. Sunday is `0` (and `7` also means Sunday in Vixie cron).
Quick reference
- Fields
- minute hour day-of-month month day-of-week
- Minute range
- 0–59
- Hour range
- 0–23
- Day-of-month range
- 1–31
- Month range
- 1–12 or JAN–DEC
- Day-of-week range
- 0–7 (Sun=0 or 7, Sat=6) or SUN–SAT
- Seconds
- Not supported
- Year
- Not supported
- Minimum interval
- 1 minute
Examples
| Expression | Description |
|---|---|
* * * * * | Every minute |
*/5 * * * * | Every 5 minutes |
0 * * * * | Every hour, on the hour |
0 0 * * * | Every day at midnight |
0 9 * * 1-5 | At 9 AM, Monday through Friday |
0 0 1 * * | At midnight on the 1st of every month |
0 0 * * 0 | At midnight every Sunday |
@reboot | Once at system startup (Linux crontab only) |
@daily | Equivalent to `0 0 * * *` |
Gotchas
- The day-of-month and day-of-week fields are OR'd together when both are set to something other than `*`. `0 0 1 * 1` runs at midnight on the 1st AND every Monday — not just on the 1st if it falls on a Monday.
- Traditional cron uses the system timezone. Set `CRON_TZ=UTC` at the top of the crontab to pin a specific zone.
- There is no `?` or `L` in standard Unix cron — those are Quartz/EventBridge extensions.
- The `@reboot`, `@hourly`, `@daily`, `@weekly`, `@monthly`, and `@yearly` shortcuts are supported by Linux crontab but not by all schedulers (Kubernetes CronJob accepts them; GitHub Actions does not).
Used by
- GNU/Linux crontab
- BSD cron
- macOS cron
- Kubernetes CronJob (`spec.schedule`)
- GitHub Actions (`on.schedule.cron`)
- GitLab CI scheduled pipelines
- Vercel cron jobs
- Cloudflare Workers cron triggers
- Node-cron, croniter, APScheduler, and most language-level libraries
Unix cron is the lingua franca of scheduled tasks. Even modern schedulers that add their own features — Kubernetes CronJob, GitHub Actions, Cloudflare Workers cron triggers — start with the Unix 5-field syntax and extend it sparingly. If you only learn one dialect, learn this one.
References
Frequently asked questions
What is the difference between Unix cron and Quartz cron?
Unix cron has 5 fields (minute, hour, day-of-month, month, day-of-week) with no seconds and Sunday=0. Quartz has 6 or 7 fields with seconds at the front, optional year at the end, and Sunday=1. Quartz also supports `?`, `L`, `W`, and `#` for advanced patterns.
Why does my crontab job not run?
Top causes: (1) the cron daemon isn't running (`systemctl status cron` on Linux), (2) the script isn't executable (`chmod +x`), (3) the PATH is different inside cron — use absolute paths and set PATH explicitly at the top of the crontab, (4) cron uses the system timezone, not your shell's, (5) the user's crontab vs root crontab confusion, and (6) the day-of-month/day-of-week OR behavior firing your job on unexpected days.
What does `@reboot` do?
`@reboot` is a Linux crontab shortcut that runs the job once when the cron daemon starts (typically at system boot). It's not supported by Kubernetes CronJob, GitHub Actions, or most cloud schedulers — those don't have a notion of "system boot." Use a systemd unit with `WantedBy=multi-user.target` or a Kubernetes Job triggered by a controller instead.