Cheat Sheets Development

Cron Syntax Cheat Sheet

The five cron fields, special characters, @daily-style macros and worked schedules with their next run times, plus how Quartz cron differs.

Last reviewed:

AdSense Placeholder
Slot: header_reference_page
On this page

A cron expression is five space-separated fields that say when a job runs; the command follows them in a crontab line. The next-run examples below were computed with a small script that implements the Vixie cron rules, starting from Saturday 10 October 2026, 12:00. Paste numeric expressions into the Cron Expression Explainer to see them in plain words.

The 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 (0 and 7 are both Sunday)
│ │ │ │ │
* * * * *  /path/to/command

Special characters

Character Meaning Example Reads as
* Every value * * * * * Every minute
, List 0 9,17 * * * At 09:00 and 17:00
- Range (inclusive) 0 9 * * 1-5 09:00 Monday to Friday
/ Step */15 * * * * Every 15 minutes (:00, :15, :30, :45)
a-b/n Step within a range 0 8-18/2 * * * 08:00, 10:00 ... 18:00
names Month or weekday names, case-insensitive (classic Vixie cron allows single names only, not lists or ranges of names) 0 4 * * sun 04:00 on Sundays

Steps count from the start of the range, not from the clock: */7 in the minute field fires at :00, :07 ... :56 and then again at :00, a gap of 4 minutes.

Macros

Macro Same as Runs
@reboot (none) Once, when the cron daemon starts
@yearly, @annually 0 0 1 1 * Midnight on 1 January
@monthly 0 0 1 * * Midnight on the 1st
@weekly 0 0 * * 0 Midnight between Saturday and Sunday
@daily, @midnight 0 0 * * * Every midnight
@hourly 0 * * * * At minute 0 of every hour

Worked examples

Expression Meaning Next runs from Sat 2026-10-10 12:00
*/15 * * * * Every 15 minutes 12:15, 12:30, 12:45, 13:00
0 * * * * Every hour on the hour 13:00, 14:00, 15:00
0 */6 * * * Every 6 hours Sat 18:00, Sun 00:00, Sun 06:00
0 9 * * 1-5 09:00 on weekdays Mon 12 Oct, Tue 13 Oct, Wed 14 Oct
*/10 9-17 * * 1-5 Every 10 minutes in office hours Mon 12 Oct 09:00, 09:10, 09:20
0 22 * * 1-5 22:00 Monday to Friday Mon 12 Oct, Tue 13 Oct
30 2 * * 0 02:30 every Sunday Sun 11 Oct, Sun 18 Oct, Sun 25 Oct
0 0 * * 6,0 Midnight at the weekend Sun 11 Oct, Sat 17 Oct, Sun 18 Oct
0 12 1,15 * * Noon on the 1st and 15th Thu 15 Oct, Sun 1 Nov, Sun 15 Nov
0 0 1 * * Midnight on the 1st of each month Sun 1 Nov, Tue 1 Dec, Fri 1 Jan 2027
0 0 1 1,7 * Twice a year Fri 1 Jan 2027, Thu 1 Jul 2027
0 0 29 2 * 29 February only Tue 29 Feb 2028, Sun 29 Feb 2032
0 0 13 * 5 The 13th or any Friday Tue 13 Oct, Fri 16 Oct, Fri 23 Oct

Vixie cron vs. Quartz

Linux and macOS use Vixie cron or its descendants (cronie, cron in Debian). Java's Quartz scheduler, and tools built on it, use a different format that looks similar but is not interchangeable.

Feature Vixie / standard cron Quartz
Fields 5: minute hour day month weekday 6 or 7: second minute hour day month weekday [year]
Day of week numbers 0-7, Sunday = 0 or 7 1-7, Sunday = 1
Both day fields set Runs when either matches Not allowed: one of them must be ?
? Not supported "No specific value" in day-of-month or day-of-week
L Not supported Last: L in day-of-month = last day, 6L = last Friday
W Not supported Nearest weekday: 15W
# Not supported Nth weekday: 6#3 = third Friday
Macros @daily and friends Not supported
Weekdays at 09:00 0 9 * * 1-5 0 0 9 ? * MON-FRI

Some libraries (such as croniter and many CI schedulers) accept L and # in five-field expressions too, but plain cron daemons do not; check before relying on them.

Crontab tips

  • Edit with crontab -e, list with crontab -l. System crontabs in /etc/crontab and /etc/cron.d/ have an extra user field before the command.
  • Use full paths. Cron runs with a minimal PATH and no login shell.
  • Escape %. In a crontab line an unescaped % ends the command and starts its standard input: write date +\%F.
  • Keep the output. Append >> /var/log/job.log 2>&1, or set MAILTO= to receive it by email.
  • Mind the time zone. Convert a schedule for another region with the Time Zone Calculator.

Try these tools

See also

  • Glossary Cron
    Cron is the scheduler on Unix-like systems that runs commands automatically at times set by a five-field schedule expression.
  • Glossary UTC
    UTC is the global reference time standard from which all time zones are defined as offsets.
  • Cheat sheet Linux Command Line Cheat Sheet
    The terminal commands for files, search, text, processes, disk, network and archives, plus pipes, redirection.
  • Cheat sheet Date & Time Formats Cheat Sheet
    ISO 8601 patterns, strftime codes, Unix time units and the leap-year, week-number and daylight-saving traps.

Frequently Asked Questions

In standard cron, when both day-of-month and day-of-week are restricted, the job runs when either matches. 0 0 13 * 5 runs on every 13th and on every Friday, not only on Friday the 13th.

The system's local time zone, unless the crontab sets one (for example CRON_TZ=UTC in cronie). Around daylight saving changes, jobs scheduled in the skipped or repeated hour can be skipped or run twice, so schedule important jobs outside 01:00 to 03:00 or run the server in UTC.

AdSense Placeholder
Slot: footer_leaderboard