Cron Jobs for Beginners — Complete Tutorial with Real Examples
What is Cron?
Cron is the Unix job scheduler. A cron expression is 5 fields telling the system exactly when to run a task: minute, hour, day-of-month, month, day-of-week.
The 5 Fields
┌ minute (0–59)
│ ┌ hour (0–23)
│ │ ┌ day of month (1–31)
│ │ │ ┌ month (1–12)
│ │ │ │ ┌ day of week (0–6, Sun=0)
30 9 * * 1-5
That expression means: 9:30 AM, Monday–Friday.
Special Operators
*every value,list:0,30= at :00 and :30-range:9-17= 9 AM–5 PM/step:*/15= every 15 minutes
Real-World Recipes
| Task | Expression |
|---|---|
| Nightly backup 2 AM | 0 2 * * * |
| Report every Monday 9 AM | 0 9 * * 1 |
| Cleanup 1st of month, midnight | 0 0 1 * * |
| Health check every 5 min | */5 * * * * |
Try the Visual Builder
Play with our Cron Expression Builder — pick values from dropdowns and see the next 5 fire times instantly.
Common Gotchas
- Timezone: cron uses server time, check
timedatectl - Day overlap: if both day-of-month and day-of-week are set (not *), it runs when EITHER matches
- Environment: cron has a minimal shell env — use absolute paths in scripts
FAQ
How is @daily different from 0 0 * * *?
They're identical — @daily is just shorthand (on many systems).
How do I see logs?
Check /var/log/syslog or add 2>>&1 | logger -t myjob to your command.