Skip to content
back to cheatsheets

Cron Syntax Cheatsheet — Schedule Expressions Explained

· Reference

Cron is the standard job scheduler on Unix-like systems. A cron expression defines when a task should run using five (or six) space-separated fields. This reference covers the syntax, special characters, and ready-to-use expressions for common schedules.

Cron Expression Format

A standard cron expression has five fields:

┌───────────── minute (0-59)
│ ┌───────────── hour (0-23)
│ │ ┌───────────── day of month (1-31)
│ │ │ ┌───────────── month (1-12 or JAN-DEC)
│ │ │ │ ┌───────────── day of week (0-7 or SUN-SAT, where 0 and 7 = Sunday)
│ │ │ │ │
* * * * *  command_to_execute

Some systems (like Quartz, Spring, and AWS) add a seconds field at the beginning, making it six fields.

Field Values

FieldAllowed ValuesAllowed Special Characters
Minute0-59* , - /
Hour0-23* , - /
Day of Month1-31* , - / ? L W
Month1-12 or JAN-DEC* , - /
Day of Week0-7 or SUN-SAT* , - / ? L #

Special Characters

CharacterMeaningExampleExplanation
*Every value* * * * *Every minute
,Value list1,15 * * * *At minute 1 and 15
-Range1-5 * * * *Minutes 1 through 5
/Step*/15 * * * *Every 15 minutes
?No specific value0 0 ? * MONUsed when day-of-month or day-of-week is irrelevant (Quartz/Spring only)
LLast0 0 L * *Last day of month (Quartz/Spring only)
WNearest weekday0 0 15W * *Nearest weekday to the 15th (Quartz/Spring only)
#Nth occurrence0 0 * * 5#3Third Friday of the month (Quartz/Spring only)

Common Schedules

ExpressionSchedule
* * * * *Every minute
*/5 * * * *Every 5 minutes
*/15 * * * *Every 15 minutes
*/30 * * * *Every 30 minutes
0 * * * *Every hour (at minute 0)
0 */2 * * *Every 2 hours
0 */6 * * *Every 6 hours
0 0 * * *Every day at midnight
0 6 * * *Every day at 6:00 AM
0 9 * * *Every day at 9:00 AM
30 8 * * *Every day at 8:30 AM
0 0 * * 0Every Sunday at midnight
0 9 * * 1-5Every weekday at 9:00 AM
0 0 1 * *First day of every month at midnight
0 0 1 1 *January 1st at midnight (yearly)
0 0 * * 1Every Monday at midnight
0 22 * * 5Every Friday at 10:00 PM
0 0 1,15 * *1st and 15th of every month at midnight
0 0 * * 6,0Every weekend at midnight
0 8-17 * * 1-5Every hour during business hours (Mon-Fri, 8AM-5PM)
0 0 L * *Last day of every month (Quartz only)
5 4 * * 0Every Sunday at 4:05 AM

Step Values Explained

The / character creates step (interval) values:

ExpressionExpandedMeaning
*/50,5,10,15,20,25,30,35,40,45,50,55Every 5th value
*/100,10,20,30,40,50Every 10th value
1/51,6,11,16,21,26,31,36,41,46,51,56Every 5th value starting at 1
0-30/100,10,20,30Every 10th value in range 0-30

Month and Day Names

You can use three-letter abbreviations instead of numbers:

FieldNames
MonthJAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC
Day of WeekSUN, MON, TUE, WED, THU, FRI, SAT
# Every Tuesday and Thursday at 9:30 AM
30 9 * * TUE,THU

# Every March 15th at noon
0 12 15 MAR *

Predefined Schedules (Shortcuts)

Some cron implementations support these shorthand strings:

ShorthandEquivalentMeaning
@yearly / @annually0 0 1 1 *Once a year (Jan 1, midnight)
@monthly0 0 1 * *Once a month (1st, midnight)
@weekly0 0 * * 0Once a week (Sunday, midnight)
@daily / @midnight0 0 * * *Once a day (midnight)
@hourly0 * * * *Once an hour
@rebootOnce at startup

Platform Differences

FeatureStandard cron (Linux/macOS)Quartz (Java/Spring)AWS EventBridgeGitHub Actions
Fields5 (min, hr, dom, mon, dow)6 or 7 (adds seconds, optional year)6 (adds year)5 (standard)
? wildcardNot supportedRequired for dom or dowSupportedNot supported
L (last)Not supportedSupportedSupportedNot supported
W (weekday)Not supportedSupportedSupportedNot supported
# (nth)Not supportedSupportedSupportedNot supported
Day of week0-7 (0,7=Sun)1-7 (1=Sun)1-7 (1=Sun)0-6 (0=Sun)
NamesSome implementationsYesYesNo

Crontab Management

# Edit your crontab
crontab -e

# List your cron jobs
crontab -l

# Remove all your cron jobs
crontab -r

# Edit another user's crontab (root)
crontab -u username -e

Crontab file format

# Environment variables
SHELL=/bin/bash
PATH=/usr/local/bin:/usr/bin:/bin
MAILTO=you@example.com

# m  h  dom mon dow  command
0    6  *   *   *    /scripts/backup.sh
*/5  *  *   *   *    /scripts/health-check.sh >> /var/log/health.log 2>&1
0    0  *   *   0    /scripts/weekly-report.sh

Tips for crontab entries:

  • Use full paths for commands (/usr/bin/python3 not python3)
  • Redirect output: >> /var/log/job.log 2>&1
  • Escape % characters with \% (they mean newline in crontab)
  • Test your command manually before scheduling it

Parse and validate cron expressions with the Cron Expression Parser or convert them to plain English with Crontab to English.

#Learn More