Cron Syntax Cheat Sheet

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)
FieldPositionAllowed ValuesWildcards
Minute1st0–59* , - /
Hour2nd0–23* , - /
Day of month3rd1–31* , - / L W
Month4th1–12 or JAN–DEC* , - /
Day of week5th0–7 or SUN–SAT* , - / L #

Note: both 0 and 7 mean Sunday in the day-of-week field.


Special Characters

CharacterNameMeaningExample
*WildcardEvery possible value* * * * * — every minute
,ListMultiple specific values1,15,30 — at minutes 1, 15, and 30
-RangeInclusive range of values9-17 — every hour from 9 to 17
/StepEvery nth value*/15 — every 15 minutes
LLastLast day of month or weekL in day-of-month — last day of the month
WWeekdayNearest weekday to a date15W — nearest weekday to the 15th
#Nth weekdaySpecific occurrence in month2#1 — first Monday of the month

Common Schedules

The expressions you'll reach for most often.

ExpressionMeaningDescription
* * * * *Every minuteRuns every 60 seconds
*/5 * * * *Every 5 minutesCommon for health checks
*/15 * * * *Every 15 minutesQuarter-hourly
*/30 * * * *Every 30 minutesHalf-hourly
0 * * * *Every hourOn the hour, every hour
0 */2 * * *Every 2 hoursEvery other hour
0 0 * * *Every day at midnightDaily reset / cleanup
0 6 * * *Every day at 6 AMMorning jobs
0 12 * * *Every day at noonMidday jobs
0 0 * * 0Every Sunday at midnightWeekly jobs
0 0 1 * *1st of every monthMonthly jobs
0 0 1 1 *Every January 1st at midnightAnnual jobs
0 9-17 * * 1-5Every hour, 9 AM–5 PM, Mon–FriBusiness hours
0 0 * * 1-5Midnight, Monday–FridayWeekday nights
30 23 L * *11:30 PM on the last day of monthEnd-of-month jobs

Multi-Value Examples

Combining characters for more precise schedules.

ExpressionMeaning
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-5Every 10 minutes, 8 AM–6 PM, Mon–Fri
0 0 * * 1,3,5Midnight on Mon, Wed, Fri
0 6 * * MON-FRI6 AM on weekdays (named days)
0 0 1 */3 *Midnight on the 1st, every 3 months
0 12 * * 5#2Noon 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.

ShorthandEquivalentMeaning
@yearly0 0 1 1 *Once a year, Jan 1st midnight
@annually0 0 1 1 *Same as @yearly
@monthly0 0 1 * *Once a month, 1st midnight
@weekly0 0 * * 0Once a week, Sunday midnight
@daily0 0 * * *Once a day, midnight
@midnight0 0 * * *Same as @daily
@hourly0 * * * *Once an hour
@rebootOnce 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.

GotchaDetail
No user environmentCron runs with a minimal PATH. Always use absolute paths (/usr/bin/python3)
Timezone is system defaultUsually UTC on servers. Set TZ=America/New_York at the top of the crontab to override
No output by defaultRedirect output or cron silently discards it: command >> /var/log/job.log 2>&1
Day-of-month AND day-of-weekIf both are set (not *), cron runs when either matches, not both
Edit safelyUse crontab -e to edit, never edit /etc/crontab directly for user jobs

Crontab Commands

TaskCommand
Edit your crontabcrontab -e
List your cron jobscrontab -l
Remove your crontabcrontab -r
Edit another user's crontabcrontab -u username -e
View cron logs (Linux)grep CRON /var/log/syslog
View cron logs (macOS)log show --predicate 'process == "cron"'

Golden Rules

  1. Always use absolute paths — cron's PATH is minimal; a command that works in your shell may silently fail in cron.
  2. Log your output — append >> /path/to/logfile 2>&1 to every job so failures leave a trace.
  3. Test the command first — run the exact command in your shell before scheduling it. If it fails there, it'll fail in cron too.
  4. Mind the timezone — production servers usually run UTC. Set TZ= at the top of your crontab if your schedule needs a specific zone.
  5. Use @reboot sparingly — 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.

Last Updated on Jul 13, 2026