Whether you're scheduling backups, running data pipelines, or automating deployments, cron is the backbone of task scheduling on Unix systems. But the syntax can be cryptic if you haven't memorized it.
Cron Expression Format
A cron expression has 5 fields (some systems use 6 or 7):
ββββββββββββββ minute (0-59)
β ββββββββββββββ hour (0-23)
β β ββββββββββββββ day of month (1-31)
β β β ββββββββββββββ month (1-12)
β β β β ββββββββββββββ day of week (0-7, both 0 and 7 = Sunday)
β β β β β
* * * * *
Special Characters
| Character | Meaning | Example |
|---|---|---|
* | Any value | * * * * * = every minute |
, | List | 1,15 * * * * = at minute 1 and 15 |
- | Range | 0 9-17 * * * = hourly, 9AM-5PM |
/ | Step | */10 * * * * = every 10 minutes |
20 Most Common Cron Schedules
Here are the cron expressions you'll use 90% of the time:
Basic Intervals
* * * * * # Every minute
*/5 * * * * # Every 5 minutes
*/15 * * * * # Every 15 minutes
*/30 * * * * # Every 30 minutes
0 * * * * # Every hour (at minute 0)
0 */2 * * * # Every 2 hours
0 */6 * * * # Every 6 hours
0 */12 * * * # Every 12 hours
Daily Schedules
0 0 * * * # Daily at midnight
0 6 * * * # Daily at 6:00 AM
0 9 * * * # Daily at 9:00 AM
30 23 * * * # Daily at 11:30 PM
Weekly & Monthly
0 9 * * 1-5 # Weekdays at 9:00 AM
0 0 * * 0 # Weekly on Sunday at midnight
0 0 * * 1 # Weekly on Monday at midnight
0 0 1 * * # Monthly on the 1st at midnight
0 0 15 * * # Monthly on the 15th at midnight
0 0 1 1 * # Yearly on January 1st
Business Hours
*/5 9-17 * * 1-5 # Every 5 min during business hours
0 9,12,17 * * 1-5 # At 9AM, noon, and 5PM on weekdays
Build Your Schedule Visually
Instead of memorizing syntax, use our free Cron Expression Generator. It lets you:
- Click presets for common schedules
- Edit each field individually
- See a human-readable description instantly
- Preview the next 5 run times
Real-World Cron Examples
Database Backup (Daily at 2 AM)
0 2 * * * pg_dump mydb > /backups/db-$(date +\%Y\%m\%d).sql
Log Rotation (Weekly)
0 0 * * 0 find /var/log/app -name '*.log' -mtime +7 -delete
Health Check (Every 5 Minutes)
*/5 * * * * curl -sf https://api.example.com/health || alert.sh
Report Generation (Weekdays at 8 AM)
0 8 * * 1-5 python3 /scripts/daily-report.py
Common Mistakes
- Day of week confusion β Both 0 and 7 mean Sunday. Use 1-5 for weekdays.
- Month indexing β Months start at 1 (January), not 0.
- Timezone awareness β Cron uses the system timezone. Always check with
timedatectl. - Missing PATH β Cron doesn't load your shell profile. Use absolute paths or set PATH in crontab.
- Output handling β Redirect stdout/stderr or cron will try to email you:
command >> /var/log/cron.log 2>&1
More Developer Tools
Build faster with our free developer tools:
- Cron Expression Generator β Visual cron builder
- JWT Decoder β Decode JSON Web Tokens
- JSON Formatter β Format and validate JSON
- SEO Checker β Audit your website's SEO
- Screenshot API β Capture websites programmatically