From database backup routines and log rotations to transactional email queues and analytics rollups, cron jobs are the invisible heartbeat of the internet.
Created in 1975 by Brian Kernighan for Version 7 Unix, the cron daemon reads a compact string of numbers and symbols called a cron expression to execute tasks on autopilot.
Despite being decades old, the 5-field syntax can still feel cryptic. In this comprehensive guide, we'll demystify every character and field so you can configure schedules with total confidence.
1. The Anatomy of a Standard 5-Field Cron Expression
A traditional Unix/Linux crontab entry contains five fields separated by white spaces:
┌───────────── Minute (0 - 59)
│ ┌─────────── Hour (0 - 23, 24-hour clock)
│ │ ┌───────── Day of Month (1 - 31)
│ │ │ ┌─────── Month (1 - 12 or JAN - DEC)
│ │ │ │ ┌───── Day of Week (0 - 6 or SUN - SAT, where 0 = Sunday)
│ │ │ │ │
* * * * *
Field Value Ranges
| Field Position | Name | Allowed Values | Special Characters |
|---|---|---|---|
| Field 1 | Minute | 0 - 59 |
* , - / |
| Field 2 | Hour | 0 - 23 |
* , - / |
| Field 3 | Day of Month | 1 - 31 |
* , - / |
| Field 4 | Month | 1 - 12 or JAN - DEC |
* , - / |
| Field 5 | Day of Week | 0 - 6 (0 = Sun) or SUN - SAT |
* , - / |
Note on 6-Field Cron (Quartz / AWS CloudWatch): Enterprise frameworks like Quartz Scheduler or AWS EventBridge often add a 6th field (Seconds or Year). Standard Linux and Unix crontab strictly uses 5 fields.
2. The 4 Special Operators Explained
Special symbols transform simple numbers into complex repeating schedules:
1. The Asterisk (*): Wildcard ("Every")
The asterisk matches every possible value in that field.
* * * * *means "every minute of every hour of every day".0 * * * *means "at minute 0 of every hour" (hourly).
2. The Comma (,): Value List ("And")
Allows you to specify multiple distinct discrete values.
0 9,17 * * *means "at 9:00 AM and 5:00 PM every day".0 0 * * 1,3,5means "at midnight on Monday, Wednesday, and Friday".
3. The Hyphen (-): Value Range ("Through")
Specifies an inclusive span of values.
0 9-17 * * *means "every hour from 9:00 AM through 5:00 PM".0 0 1-7 * *means "midnight on days 1 through 7 of the month".
4. The Slash (/): Step Intervals ("Every N units")
Skips values in intervals.
*/15 * * * *means "every 15 minutes" (minutes 0, 15, 30, 45).0 */3 * * *means "every 3 hours" (midnight, 3am, 6am, 9am, 12pm, 3pm, 6pm, 9pm).10-50/10 * * * *means "every 10 minutes between minute 10 and 50" (10, 20, 30, 40, 50).
3. Real-World Cheat Sheet: 10 Everyday Cron Schedules
| Schedule Goal | Expression | Explanation |
|---|---|---|
| Every minute | * * * * * |
Fires continuously at second 0 of each minute |
| Every 5 minutes | */5 * * * * |
At minutes 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 |
| Every 15 minutes | */15 * * * * |
At :00, :15, :30, and :45 |
| Every hour on the hour | 0 * * * * |
At minute 0 of every hour |
| Every 6 hours | 0 */6 * * * |
At 00:00, 06:00, 12:00, 18:00 |
| Every day at midnight | 0 0 * * * |
At 00:00 every calendar day |
| Every day at 8:30 AM | 30 8 * * * |
Standard morning batch run |
| Every weekday (Mon–Fri) at 9 AM | 0 9 * * 1-5 |
Business hours trigger |
| Every Sunday at 3 AM | 0 3 * * 0 |
Low-traffic weekly maintenance window |
| First day of every month at midnight | 0 0 1 * * |
Monthly billing / invoice generation |
4. The "Day of Month" vs. "Day of Week" Gotcha
There is a subtle feature in standard Unix cron that surprises even veteran engineers:
When both "Day of Month" (field 3) and "Day of Week" (field 5) are specified with values other than *, cron treats them with an OR condition, not an AND condition!
For example:
0 0 15 * 5
You might expect this to trigger only when the 15th of the month happens to be a Friday. It does not. Instead, it will run on:
- Every 15th day of the month, AND
- Every Friday of the month!
If you need a task to run strictly on the "third Friday of the month", you typically schedule it weekly and add a shell check:
0 0 * * 5 [ $(date +%d) -ge 15 -a $(date +%d) -le 21 ] && /path/to/script.sh
5. Build, Validate & Test Cron Expressions Online
Writing cron expressions manually can be prone to syntax errors and timezone misunderstandings.
Use the KitWharf Cron Expression Generator & Explainer:
- Plain-English Translation: Instantly translates cryptic strings like
*/20 8-17 * * 1-5into "Every 20 minutes, between 08:00 and 17:59, Monday through Friday". - Interactive Visual Selector: Click to toggle minutes, hours, days, and months without writing syntax manually.
- Future Execution Preview: See the exact next 5 scheduled timestamps to verify your schedule before deploying to production.
- 100% Private & In-Browser: Zero telemetry, zero server roundtrips.