How to Schedule Tasks With Cron on Linux
Cron runs scheduled commands at fixed times or intervals using crontab syntax. Learn the five-field schedule format and how to add a cron job.
Published September 21, 2026
cron runs commands on a schedule. Edit your jobs with crontab -e; each line has five time fields followed by the command.
The concept
The five fields are minute, hour, day-of-month, month and day-of-week. A * means every value, */5 means every 5th, and 1-5 is a range.
Cron runs with a minimal environment: a short PATH, no shell profile and no terminal. Use absolute paths and redirect output to a log.
Anatomy of a cron line
*/15 9-17 * * 1-5 /usr/bin/php /var/www/artisan schedule:run
min hour dom mon dow command
→ every 15 min, 09–17h, Mon–Fri
Practical examples
Edit and list
crontab -e
crontab -lNightly backup at 02:30 with logging
30 2 * * * /home/ada/backup.sh >> /var/log/backup.log 2>&1Every reboot
@reboot /home/ada/start.shSet PATH at the top
PATH=/usr/local/bin:/usr/bin:/bin
MAILTO=""Common mistakes
- Relative paths that work in your shell but not in cron.
- Forgetting % must be escaped in cron commands.
- Not redirecting output, so jobs fail silently.
- Not making scripts executable.
Key takeaways
- min hour dom mon dow command.
- Absolute paths and redirected logs.
- Use crontab.guru to check schedules.
FAQ
How do I see cron errors?
Check your redirected log or grep CRON /var/log/syslog.
cron vs systemd timers?
Timers offer logging and dependencies; cron is simpler and universal.