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
| Field | Allowed Values | Allowed Special Characters |
|---|---|---|
| Minute | 0-59 | * , - / |
| Hour | 0-23 | * , - / |
| Day of Month | 1-31 | * , - / ? L W |
| Month | 1-12 or JAN-DEC | * , - / |
| Day of Week | 0-7 or SUN-SAT | * , - / ? L # |
Special Characters
| Character | Meaning | Example | Explanation |
|---|---|---|---|
* | Every value | * * * * * | Every minute |
, | Value list | 1,15 * * * * | At minute 1 and 15 |
- | Range | 1-5 * * * * | Minutes 1 through 5 |
/ | Step | */15 * * * * | Every 15 minutes |
? | No specific value | 0 0 ? * MON | Used when day-of-month or day-of-week is irrelevant (Quartz/Spring only) |
L | Last | 0 0 L * * | Last day of month (Quartz/Spring only) |
W | Nearest weekday | 0 0 15W * * | Nearest weekday to the 15th (Quartz/Spring only) |
# | Nth occurrence | 0 0 * * 5#3 | Third Friday of the month (Quartz/Spring only) |
Common Schedules
| Expression | Schedule |
|---|---|
* * * * * | 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 * * 0 | Every Sunday at midnight |
0 9 * * 1-5 | Every 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 * * 1 | Every Monday at midnight |
0 22 * * 5 | Every Friday at 10:00 PM |
0 0 1,15 * * | 1st and 15th of every month at midnight |
0 0 * * 6,0 | Every weekend at midnight |
0 8-17 * * 1-5 | Every hour during business hours (Mon-Fri, 8AM-5PM) |
0 0 L * * | Last day of every month (Quartz only) |
5 4 * * 0 | Every Sunday at 4:05 AM |
Step Values Explained
The / character creates step (interval) values:
| Expression | Expanded | Meaning |
|---|---|---|
*/5 | 0,5,10,15,20,25,30,35,40,45,50,55 | Every 5th value |
*/10 | 0,10,20,30,40,50 | Every 10th value |
1/5 | 1,6,11,16,21,26,31,36,41,46,51,56 | Every 5th value starting at 1 |
0-30/10 | 0,10,20,30 | Every 10th value in range 0-30 |
Month and Day Names
You can use three-letter abbreviations instead of numbers:
| Field | Names |
|---|---|
| Month | JAN, FEB, MAR, APR, MAY, JUN, JUL, AUG, SEP, OCT, NOV, DEC |
| Day of Week | SUN, 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:
| Shorthand | Equivalent | Meaning |
|---|---|---|
@yearly / @annually | 0 0 1 1 * | Once a year (Jan 1, midnight) |
@monthly | 0 0 1 * * | Once a month (1st, midnight) |
@weekly | 0 0 * * 0 | Once a week (Sunday, midnight) |
@daily / @midnight | 0 0 * * * | Once a day (midnight) |
@hourly | 0 * * * * | Once an hour |
@reboot | — | Once at startup |
Platform Differences
| Feature | Standard cron (Linux/macOS) | Quartz (Java/Spring) | AWS EventBridge | GitHub Actions |
|---|---|---|---|---|
| Fields | 5 (min, hr, dom, mon, dow) | 6 or 7 (adds seconds, optional year) | 6 (adds year) | 5 (standard) |
? wildcard | Not supported | Required for dom or dow | Supported | Not supported |
L (last) | Not supported | Supported | Supported | Not supported |
W (weekday) | Not supported | Supported | Supported | Not supported |
# (nth) | Not supported | Supported | Supported | Not supported |
| Day of week | 0-7 (0,7=Sun) | 1-7 (1=Sun) | 1-7 (1=Sun) | 0-6 (0=Sun) |
| Names | Some implementations | Yes | Yes | No |
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/python3notpython3) - 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.