cron job runs a command on a schedule defined by a five-field expression. Each field controls a unit of time — minute, hour, day of month, month, and day of week — and special characters let you express ranges, intervals, lists, and wildcards. This reference covers every field, every character, and the schedules you'll use most.
Rather build than read? Use the Cron Job Generator to construct and preview any expression visually without memorizing the syntax.
The Five Fields
* * * * *
│ │ │ │ └── Day of week (0–7, Sun = 0 or 7)
│ │ │ └───── Month (1–12)
│ │ └──────── Day of month (1–31)
│ └─────────── Hour (0–23)
└────────────── Minute (0–59)
| Field | Position | Allowed Values | Wildcards |
|---|---|---|---|
| Minute | 1st | 0–59 | * , - / |
| Hour | 2nd | 0–23 | * , - / |
| Day of month | 3rd | 1–31 | * , - / L W |
| Month | 4th | 1–12 or JAN–DEC | * , - / |
| Day of week | 5th | 0–7 or SUN–SAT | * , - / L # |
Note: both
0and7mean Sunday in the day-of-week field.
Special Characters
| Character | Name | Meaning | Example |
|---|---|---|---|
* | Wildcard | Every possible value | * * * * * — every minute |
, | List | Multiple specific values | 1,15,30 — at minutes 1, 15, and 30 |
- | Range | Inclusive range of values | 9-17 — every hour from 9 to 17 |
/ | Step | Every nth value | */15 — every 15 minutes |
L | Last | Last day of month or week | L in day-of-month — last day of the month |
W | Weekday | Nearest weekday to a date | 15W — nearest weekday to the 15th |
# | Nth weekday | Specific occurrence in month | 2#1 — first Monday of the month |
Common Schedules
The expressions you'll reach for most often.
| Expression | Meaning | Description |
|---|---|---|
* * * * * | Every minute | Runs every 60 seconds |
*/5 * * * * | Every 5 minutes | Common for health checks |
*/15 * * * * | Every 15 minutes | Quarter-hourly |
*/30 * * * * | Every 30 minutes | Half-hourly |
0 * * * * | Every hour | On the hour, every hour |
0 */2 * * * | Every 2 hours | Every other hour |
0 0 * * * | Every day at midnight | Daily reset / cleanup |
0 6 * * * | Every day at 6 AM | Morning jobs |
0 12 * * * | Every day at noon | Midday jobs |
0 0 * * 0 | Every Sunday at midnight | Weekly jobs |
0 0 1 * * | 1st of every month | Monthly jobs |
0 0 1 1 * | Every January 1st at midnight | Annual jobs |
0 9-17 * * 1-5 | Every hour, 9 AM–5 PM, Mon–Fri | Business hours |
0 0 * * 1-5 | Midnight, Monday–Friday | Weekday nights |
30 23 L * * | 11:30 PM on the last day of month | End-of-month jobs |
Multi-Value Examples
Combining characters for more precise schedules.
| Expression | Meaning |
|---|---|
0 9,12,17 * * * | At 9 AM, noon, and 5 PM daily |
0 0 1,15 * * | Midnight on the 1st and 15th |
*/10 8-18 * * 1-5 | Every 10 minutes, 8 AM–6 PM, Mon–Fri |
0 0 * * 1,3,5 | Midnight on Mon, Wed, Fri |
0 6 * * MON-FRI | 6 AM on weekdays (named days) |
0 0 1 */3 * | Midnight on the 1st, every 3 months |
0 12 * * 5#2 | Noon on the second Friday of the month |
Non-Standard Expressions
Many cron implementations (Quartz, AWS, systemd) support shortcuts and a sixth field. Check your platform's docs.
Shorthand Strings
Supported in most Unix crons and Vixie cron.
| Shorthand | Equivalent | Meaning |
|---|---|---|
@yearly | 0 0 1 1 * | Once a year, Jan 1st midnight |
@annually | 0 0 1 1 * | Same as @yearly |
@monthly | 0 0 1 * * | Once a month, 1st midnight |
@weekly | 0 0 * * 0 | Once a week, Sunday midnight |
@daily | 0 0 * * * | Once a day, midnight |
@midnight | 0 0 * * * | Same as @daily |
@hourly | 0 * * * * | Once an hour |
@reboot | — | Once at system startup |
Six-Field Cron (Quartz / AWS EventBridge)
Some platforms add a seconds field at the start or a year field at the end.
# Quartz (seconds first)
* * * * * *
│ │ │ │ │ └── Year (optional)
│ │ │ │ └───── Day of week
│ │ │ └──────── Month
│ │ └─────────── Day of month
│ └────────────── Hour
└───────────────── Second (0–59)
# AWS EventBridge (rate or cron with year)
cron(0 12 * * ? *) # Every day at noon UTC
rate(5 minutes) # Every 5 minutes
Cron Environment
Things that bite developers when running cron jobs in production.
| Gotcha | Detail |
|---|---|
| No user environment | Cron runs with a minimal PATH. Always use absolute paths (/usr/bin/python3) |
| Timezone is system default | Usually UTC on servers. Set TZ=America/New_York at the top of the crontab to override |
| No output by default | Redirect output or cron silently discards it: command >> /var/log/job.log 2>&1 |
| Day-of-month AND day-of-week | If both are set (not *), cron runs when either matches, not both |
| Edit safely | Use crontab -e to edit, never edit /etc/crontab directly for user jobs |
Crontab Commands
| Task | Command |
|---|---|
| Edit your crontab | crontab -e |
| List your cron jobs | crontab -l |
| Remove your crontab | crontab -r |
| Edit another user's crontab | crontab -u username -e |
| View cron logs (Linux) | grep CRON /var/log/syslog |
| View cron logs (macOS) | log show --predicate 'process == "cron"' |
Golden Rules
- Always use absolute paths — cron's
PATHis minimal; a command that works in your shell may silently fail in cron. - Log your output — append
>> /path/to/logfile 2>&1to every job so failures leave a trace. - Test the command first — run the exact command in your shell before scheduling it. If it fails there, it'll fail in cron too.
- Mind the timezone — production servers usually run UTC. Set
TZ=at the top of your crontab if your schedule needs a specific zone. - Use
@rebootsparingly — it's useful but runs before networking is up, so services that depend on the network may fail.
Tip: Not sure if your expression is right? Paste it into the Cron Job Generator to preview exactly when it will next fire.
Frequently Asked Questions
What are the five fields in a cron expression? From left to right: minute (0–59), hour (0–23), day of month (1–31), month (1–12), and day of week (0–7, where both 0 and 7 are Sunday).
What does */5 mean in cron?
The / is a step character. */5 in the minute field means "every 5 minutes"
— it starts at 0 and steps by 5, so it fires at 0, 5, 10, 15, and so on.
How do I run a cron job every day at a specific time?
Set the minute and hour fields and use * for the rest. For example,
30 8 * * * runs every day at 8:30 AM.
What is the difference between 0 0 * * 0 and @weekly?
They are equivalent. @weekly is a shorthand that expands to 0 0 * * 0 —
midnight on Sunday.
Why is my cron job not running?
The most common reasons are: the command uses a relative path that isn't in
cron's minimal PATH; output isn't redirected so errors are silently discarded;
or the timezone doesn't match your expectation. Check logs with
grep CRON /var/log/syslog.
Can I run a cron job every second? Not with standard Unix cron, which has a minimum resolution of one minute. For sub-minute scheduling, use a platform that supports a seconds field (like Quartz or AWS EventBridge), or run a loop inside the cron job itself.