Lesson 2

Fields and Syntax

Wildcards, lists, ranges, and step values in five-field cron.

Reading cron means reading five constrained integers (or wildcards) from left to right.

Field order and bounds

FieldAllowed values (typical Unix)
Minute0–59
Hour0–23
Day of month1–31
Month1–12 (or names in some parsers)
Day of week0–7 (0 and 7 often both mean Sunday)

Memonic: minute before hour, then day-of-month before month, then weekday.

Some systems add a seconds field or year field—this course focuses on the common five-field line unless noted.

Wildcard *

* in a field means “every allowed value.”

  • * * * * * — every minute (very aggressive; rarely what you want in production)
  • 0 * * * * — at minute 0 of every hour (hourly on the hour)

Lists and ranges

  • List: 0,15,30,45 in the minute field — four times per hour
  • Range: 1-5 in weekday — Monday through Friday (see platform notes for 0 vs 1 start)
  • Combined: 9-17 in hour — business-hour window each matched minute

Step syntax /

*/5 in the minute field means “every 5 minutes starting at 0”: 0, 5, 10, …

30-59/10 means 30, 40, 50 in the minute field.

Steps apply to the atom before /. Misplaced steps are a common parse error.

Day-of-month vs day-of-week

When both day-of-month and day-of-week are restricted (not *), Unix cron usually treats them as OR, not AND:

  • 0 0 1 * 1 — midnight on the 1st or midnight on Mondays (either triggers)

If you need “first Monday of the month,” cron alone is awkward—use a wrapper script or a richer scheduler.

Invalid combinations

February 31 and minute 60 are invalid. Good parsers reject them early; silent tools may produce empty next-run lists.

Key takeaway

Build expressions field by field: fix minute and hour first, then decide whether day filters belong in DOM, DOW, or both—knowing OR semantics. Test with a parser before committing to production crontab.

When you want to practice, use the related DevCove tool — optional, not part of this lesson.

Open related tool

Back to course overview