Cron syntax cheat sheet
The reference for reading and writing cron expressions — every field, every operator, common recipes, and the day-of-week trap that catches everyone.
Cron syntax is compact, powerful, and easy to misread — one wrong asterisk and your "hourly" job runs every minute. This is the cron cheat sheet we keep pinned. Everything here works in standard Unix cron, GitHub Actions, Kubernetes CronJobs, and most cloud schedulers. When in doubt, paste your expression into the cron expression explainer to see the next five runs in plain English.
Cron syntax: the five fields
Standard cron job syntax is five space-separated fields, read left to right:
┌───────────── minute (0 - 59) │ ┌─────────── hour (0 - 23) │ │ ┌───────── day of month (1 - 31) │ │ │ ┌─────── month (1 - 12 or JAN-DEC) │ │ │ │ ┌───── day of week (0 - 6 or SUN-SAT; 0 and 7 both = Sunday) │ │ │ │ │ * * * * * command
Cron table format
A crontab is a plain table: one cron expression per row, followed by the command to run. Blank lines and lines starting with # are ignored. The cron table format is the same across Vixie cron, cronie, and most Linux distributions.
# .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) # | | | | | # * * * * * command-to-be-executed 0 9 * * 1-5 /usr/local/bin/backup.sh
Cron special characters
| Character | Name | Meaning |
|---|---|---|
* | Asterisk | Every allowed value in this field. |
, | List | Run at each listed value. 0,15,30,45 in the minute field fires at those four minutes. |
- | Range | Run across a continuous range. 1-5 in day-of-week is Monday through Friday. |
/ | Step | Run every N units. */15 means every 15; 2-20/2 means even numbers from 2 to 20. |
L | Last | Non-standard but common in Quartz: L in day-of-month means the last day of the month. |
# | Nth | Non-standard but common in Quartz: 0 9 * * 1#2 is the second Monday of the month. |
Cron formatting rules
- Fields are separated by a single space. Extra spaces are not allowed in standard cron — five fields exactly.
- Day-of-week can be numbers
0-6or three-letter namesSUN-SAT. Months can be1-12orJAN-DEC. - Ranges and lists can be combined:
0 9-17/2 * * 1-5means every two hours between 09:00 and 17:00 on weekdays. - The command part is everything after the fifth field. It is passed to the shell, so quoting and redirection work as usual.
Cron job syntax examples
| Expression | Meaning |
|---|---|
* * * * * | Every minute. |
*/5 * * * * | Every 5 minutes. |
0 * * * * | Top of every hour. |
0 */2 * * * | Every 2 hours on the hour. |
0 9 * * * | Every day at 09:00. |
0 9 * * 1-5 | Weekdays at 09:00. |
0 9 * * 1 | Every Monday at 09:00. |
0 0 1 * * | Midnight on the 1st of every month. |
0 0 * * 6#1 | First Saturday of the month (Quartz-style). |
0 0 29 2 * | Every leap day — and only on leap years. |
Cron expression to never run
There is no official "never" value in standard cron, but you can pick a date that does not exist. The most common pattern is February 31st:
0 0 31 2 * /bin/true
February never has 31 days, so the schedule never fires. This is useful when a config file requires a cron line but you want to disable the job without deleting it. Some schedulers (Quartz, AWS EventBridge) also accept a sixth seconds field, in which case a valid cron expression with a non-existent date still works the same way.
Crontab columns: the 6-field variant
Some schedulers — Quartz, Spring's @Scheduled, AWS EventBridge — accept a sixth field for seconds at the front of the expression:
┌────────────── seconds (0 - 59) │ ┌──────────── minute (0 - 59) │ │ ┌────────── hour (0 - 23) │ │ │ ┌──────── day of month (1 - 31) │ │ │ │ ┌────── month (1 - 12) │ │ │ │ │ ┌──── day of week (0 - 6) │ │ │ │ │ │ 0 0 9 * * MON-FRI command
Standard Unix cron does not have a seconds field; adding a sixth field there will error out. Always check your scheduler's documentation before choosing between 5-field and 6-field crontab columns.
Named aliases
These shortcuts are supported by Vixie cron, GitHub Actions, and most modern cron implementations:
| Alias | Equivalent |
|---|---|
@yearly / @annually | 0 0 1 1 * |
@monthly | 0 0 1 * * |
@weekly | 0 0 * * 0 |
@daily / @midnight | 0 0 * * * |
@hourly | 0 * * * * |
The day-of-month / day-of-week trap
When both day-of-month and day-of-week are restricted (neither is *), most cron implementations run the job when either matches — not both. So 0 12 13 * 5 runs at noon every Friday and on the 13th of every month, not only on "Friday the 13th". Keep one of them as * unless you actually want the union.
Timezone gotchas
- Most cron daemons run in the server's local timezone. GitHub Actions uses UTC. Kubernetes CronJobs default to UTC.
- Daylight saving transitions can skip or double-fire a job scheduled during the shifted hour. Schedule critical jobs outside 01:00–03:00 local time, or run them in UTC.
- Verify with the cron expression explainer — it prints the next five occurrences in UTC so you can spot off-by-one-hour mistakes.
Debugging a cron job that isn't running
- Confirm the expression with a parser — one misplaced space is enough to break it.
- Check the daemon's log (
/var/log/cron,journalctl -u cron). - Redirect stdout and stderr to a file:
* * * * * /path/cmd >> /tmp/cmd.log 2>&1. - Verify the executing user has the PATH and env vars your command needs — cron's PATH is minimal.
- For containers, remember that cron only fires while the container is running.
Frequently asked questions
- What is cron syntax?
- Cron syntax is five space-separated fields describing minute, hour, day of month, month, and day of week, followed by the command to run.
- What are the cron special characters?
*(every value),,(list),-(range),/(step), and in some schedulersL(last) and#(nth).- How do I format a cron job correctly?
- Use exactly five fields, separated by single spaces. Use numbers or three-letter names for months and days, and place the command after the fifth field.
- What is the cron expression to never run?
- Use an impossible date such as
0 0 31 2 *(February 31st). The schedule is valid but never fires. - How many columns are in a crontab?
- Standard Unix crontab has five time columns plus the command. Some schedulers add a sixth seconds column at the front.
- What is a cron cheat sheet?
- A quick reference for cron fields, operators, common examples, and gotchas — exactly like this page.
Cron isn't magic — it's a five-column table with a few operators. Once the fields click, reading a crontab is the same skill as reading a recipe.