The crontab format at a glance
A cron expression is five fields separated by spaces. In a crontab file, the command follows on the same line:
MIN HOUR DOM MON DOW COMMAND
30 2 * * 1-5 /usr/local/bin/backup.sh
│ │ │ │ │
│ │ │ │ └──── day of week: Monday to Friday
│ │ │ └───────── month: every month
│ │ └────────────── day of month: every day
│ └──────────────────── hour: 2 AM
└───────────────────────── minute: 30
Read it as “at 2:30 AM, Monday to Friday”.
| # | Field | Allowed values | Notes |
|---|---|---|---|
| 1 | Minute | 0–59 | — |
| 2 | Hour | 0–23 | 24-hour clock; midnight is 0, not 24 |
| 3 | Day of month | 1–31 | Days a month doesn't have are skipped |
| 4 | Month | 1–12 or JAN–DEC | Names are not case-sensitive |
| 5 | Day of week | 0–7 or SUN–SAT | 0 and 7 are both Sunday |
Names are the first three letters of the English month or day. Numbers work in every cron implementation; some older documentation says ranges and lists of names (such as MON-FRI) aren't allowed, so 1-5 is the portable choice.
Cron operators
| Operator | Meaning | Example | Runs |
|---|---|---|---|
* | Every value | * * * * * | Every minute |
, | List | 0 9,17 * * * | At 9 AM and 5 PM |
- | Range, both ends included | 0 9-17 * * * | Every hour from 9 AM to 5 PM |
/ | Step | */15 * * * * | Every 15 minutes |
a-b/n | Step within a range | 0 8-18/2 * * * | Every 2 hours from 8 AM to 6 PM |
Operators combine: 0,30 9-17 * * 1-5 runs every half hour from 9 AM to 5:30 PM on weekdays.
Steps restart at the start of each range
*/7 in the minute field runs at 0, 7, 14 … 56 and then at 0 again, so the gap across the hour is 4 minutes, not 7. For an even rhythm, use a step that divides 60 for minutes (2, 3, 4, 5, 6, 10, 12, 15, 20, 30) or 24 for hours (2, 3, 4, 6, 8, 12).
For the same reason */90 does not mean every 90 minutes: depending on the implementation it is rejected or quietly treated as minute 0 only. To run a job every 90 minutes, use two lines:
0 0-21/3 * * * /usr/local/bin/job.sh
30 1-22/3 * * * /usr/local/bin/job.sh
Special strings
| String | Same as | Runs |
|---|---|---|
@yearly @annually | 0 0 1 1 * | Once a year, January 1 at midnight |
@monthly | 0 0 1 * * | On the 1st of every month at midnight |
@weekly | 0 0 * * 0 | Every Sunday at midnight |
@daily @midnight | 0 0 * * * | Every day at midnight |
@hourly | 0 * * * * | At the start of every hour |
@reboot | — | Once, when cron starts after a boot |
Linux cron (Vixie cron and cronie) accepts all of them, and Kubernetes accepts all except @reboot. Other schedulers may not, so check before you rely on them.
Day of month and day of week: the OR rule
If both day fields are restricted, Unix cron runs the job when either one matches. 0 9 1 * 1 runs at 9 AM on the 1st of every month and on every Monday, not only on Mondays that fall on the 1st. If one of the two fields is *, only the other one counts.
To get AND logic, schedule the broader condition and test the other one in the command. The first Monday of the month, for example, is the Monday that falls on day 1 to 7:
0 9 * * 1 [ "$(date +\%d)" -le 7 ] && /usr/local/bin/monthly-report.sh
Quartz, AWS and Salesforce avoid the problem differently: they require ? in one of the two day fields.
Values that look right but aren't
0 0 30 2 *never runs: February has no 30th.0 0 31 * *runs only in the seven months that have 31 days. For the last day of every month, use this workaround.0 24 * * *is invalid; midnight is hour0.- Unix cron has no seconds field. The smallest interval is one minute (see how to run a job every 30 seconds).
- Times follow the server's time zone, not yours, and cloud servers often run in UTC.
Cron syntax on other platforms
Many schedulers borrow cron syntax and extend it. The extra symbols mean: ? no specific value, L last, W nearest weekday, # nth weekday of the month, and H a value Jenkins derives from the job name.
| Platform | Fields | Extra symbols |
|---|---|---|
| Unix / Linux crontab | 5 | — |
| Quartz | 6–7 | ? L W # |
| Spring | 6 | ? L W # |
| AWS EventBridge | 6 | ? L W # |
| Jenkins | 5 | H |
| Salesforce | 6–7 | ? L W # |
| Hangfire | 5–6 | ? L W # |
| Airflow | 5 | ? L W # |
| node-cron | 5–6 | ? L W # |
Cron syntax examples
| Cron expression | Schedule |
|---|---|
* * * * * | Every minute. |
*/5 * * * * | Every 5 minutes. |
*/15 * * * * | Every 15 minutes. |
0 * * * * | At 0 minutes past the hour. |
0 */6 * * * | At 0 minutes past the hour, every 6 hours. |
0 0 * * * | At 12:00 AM. |
0 2 * * * | At 2:00 AM. |
0 9 * * 1-5 | At 9:00 AM, Monday through Friday. |
0 0 * * 0 | At 12:00 AM, only on Sunday. |
0 0 1 * * | At 12:00 AM, on day 1 of the month. |
0 0 1 */3 * | At 12:00 AM, on day 1 of the month, only in January, April, July, and October. |
0 0 1 1 * | At 12:00 AM, on day 1 of the month, only in January. |
Browse all cron expression examples, or build your own with the cron expression generator.
Frequently asked questions
What is the correct cron syntax?
Five fields separated by spaces (minute, hour, day of month, month, day of week), followed by the command in a crontab: */10 * * * * /path/to/script.sh. Each field takes a number, *, a list (1,15), a range (1-5) or a step (*/10).
How many fields does a cron expression have?
Five in Unix cron. Quartz, Spring and Salesforce add a seconds field at the start (Quartz and Salesforce also allow an optional year at the end), and AWS EventBridge has six fields ending with a year.
What does the asterisk mean in cron?
“Every value.” * in the hour field means every hour, and * * * * * runs every minute.
Is cron syntax the same everywhere?
No. The five basic fields are widely shared, but Quartz and Salesforce count Sunday as 1, AWS needs a year field and ?, Jenkins adds H, and Hangfire and node-cron accept optional seconds. Use the generator for your platform to stay within its rules.
Can I use names like MON or JAN?
Yes, in the month and day-of-week fields: JAN–DEC and SUN–SAT, in any case. For ranges, numbers such as 1-5 are the most portable choice.
How do I run a cron job every 90 minutes?
A single expression can’t do it, because steps restart every hour. Use two lines, 0 0-21/3 * * * and 30 1-22/3 * * *, which together fire at 0:00, 1:30, 3:00, 4:30 and so on.
Does cron support seconds?
Not in Unix crontab, where the smallest unit is a minute. Schedulers such as Spring, Quartz and node-cron add a seconds field, so */30 * * * * * runs every 30 seconds there.