Boneyard Tools

Cron syntax explained field by field

A practical guide to the five cron fields, wildcards, ranges, and steps, with worked examples you can drop straight into a crontab.

The anatomy of a cron line

A classic cron entry is five space-separated fields followed by the command to run. Reading left to right they are minute, hour, day-of-month, month, and day-of-week. A schedule fires when the current time matches every field at once, so 30 9 * * 1 means minute 30 of hour 9 on any day of any month, but only on Mondays. Getting comfortable with that left-to-right order is the key to reading any cron line at a glance.

Wildcards, lists, ranges, and steps

Each field supports four building blocks. A star matches every value. A comma-separated list like 1,15 matches several specific values. A range like 1-5 matches an inclusive span, and a step like */15 matches every fifteenth value starting from zero. You can combine them, so 0-30/10 in the minute field means minutes 0, 10, 20, and 30. These operators are what let a single short line express schedules that would otherwise need many separate entries.

The day-of-month and day-of-week trap

The two day fields interact in a way that surprises people. In standard cron, if both day-of-month and day-of-week are restricted, the job runs when either one matches, not both. So 0 0 1 * 1 fires on the first of the month and on every Monday, which is rarely what a beginner expects. To pin a job to a single condition, leave the other day field as a wildcard, which is exactly what the presets in this generator do.

Testing before you trust it

Cron runs unattended, so a small mistake can mean a job that never fires or one that hammers your system every minute. Before relying on a schedule, read the plain-English summary this tool produces, and for high-stakes jobs confirm the behaviour against your specific scheduler. Remember that cron uses the server's local time zone, so a schedule that looks right on your laptop may run at a different wall-clock time in production.

Frequently asked questions

What does */5 mean in the minute field?

It means every five minutes, firing at minute 0, 5, 10, and so on through the hour. The star before the slash is the range (all minutes) and the number after it is the step.

How do I run a job only on the last day of the month?

Standard 5-field cron cannot express that directly. Some schedulers add an L flag for it; otherwise the common workaround is to run daily and exit early unless tomorrow is the first of the month.

Does cron use UTC or local time?

It uses the time zone of the machine running the cron daemon, which is often local time. If you need UTC, set the server or the cron entry's time zone explicitly.