Lesson 4 of 6

Special Characters

* alone only gets you "every value" or one specific number. Real schedules — "every 10 minutes," "9am and 5pm," "weekdays only" — need a bit more expressive power. Four special characters give you lists, ranges, and steps without ever leaving the five-field format.

💡 The Bottom Line

Four characters do almost all the work beyond a plain number: * means every value, , means a list of specific values, - means a range of consecutive values, and / means a step (every Nth value). Combine them, and you can express almost any real-world schedule precisely.

The asterisk (*) — every value

You've already been using this: * in a field means "any value here is fine, don't restrict it." It's the default, wide-open state of a field.

The comma (,) — a list of values

0 9,17 * * *

The comma lets you list specific values in one field. Here, the hour field is 9,17 — 9am and 5pm (17:00). Combined with minute 0: this job runs twice a day, once at 9am and once at 5pm.

The hyphen (-) — a range

0 9-17 * * *

A hyphen between two numbers means "every value in this inclusive range." Here, hour 9-17 means every hour from 9am through 5pm. Combined with minute 0: this job runs once every hour, on the hour, from 9am to 5pm.

The slash (/) — step values

*/5 * * * *

A slash after a value (or after *) means "every Nth value, starting from the base." */5 in the minute field means every 5th minute: 0, 5, 10, 15, and so on — in other words, every 5 minutes.

📋 The four characters, side by side

  • * — every value ("don't restrict this field")
  • , — a list ("these specific values")
  • - — a range ("every value from A to B")
  • / — a step ("every Nth value")

Combining them for a realistic schedule

Real schedules often combine several of these in one expression. Consider: "every 10 minutes, only on weekdays, between 9am and 5pm":

*/10 9-17 * * 1-5

Reading it: minute */10 (every 10 minutes), hour 9-17 (9am through 5pm), day-of-month * (unrestricted), month * (unrestricted), day-of-week 1-5 (Monday through Friday). Each field's special character is doing exactly one job, and together they narrow the schedule down precisely.

⚠️ Watch Out

A step value like */10 in the minute field means "every 10 minutes starting from 0" (0, 10, 20, 30, 40, 50) — it does not mean "10 times, evenly spaced" if 60 doesn't divide evenly by your step. */7 in the minute field, for example, produces 0, 7, 14, 21, ... 56 — then jumps straight to 0 again at the next hour, giving an uneven final gap. Stick to step values that divide evenly into the field's range (60 for minutes, 24 for hours) if you want a perfectly even cadence.

🙋 There Are No Dumb Questions

Q: Can I combine a comma and a hyphen in the same field, like 1-5,9-17?
A: Yes — most cron implementations allow combining lists, ranges, and steps freely within one field, separated by commas. 1-5,9-17 in an hour field would mean "every hour from 1am-5am, plus every hour from 9am-5pm." It reads a little dense, but it follows the same building blocks you already know.

🔧 Try It Yourself

Write a cron expression for "every 30 minutes, but only during business hours (9am to 5pm), Monday through Friday." Try it before checking: */30 9-17 * * 1-5.

✅ Quick Check

What does the hour field 9,17 mean?


Next up: how to actually verify a cron expression means what you think it means, before you ship it — and what to check when a scheduled job silently doesn't run.

← Back to
Next →