Cron guide
What cron does in production
The cron daemon (cron or crond) wakes up every minute and checks
whether any scheduled jobs should run. User jobs live in per-user crontabs; system jobs
live in /etc/crontab, /etc/cron.d/, or drop-in directories like
/etc/cron.daily/.
Debian 12+ and systemd timers
Since Debian 12 (Bookworm), the base system no longer depends on the traditional
cron daemon. Many packages now schedule maintenance with native
systemd timers (for example apt-daily.timer,
dpkg-db-backup.timer) instead of cron drop-ins. Leftover files under
/etc/cron.d/ or /etc/cron.daily/ may still be present,
but are ignored when a matching .timer unit exists.
Minimal or cloud images may not install the cron package at all —
crontab -e will fail until you run apt install cron.
For your own jobs you can either install cron as before, write native
.service + .timer units, or use the optional
systemd-cron package, which translates crontab files into systemd units.
Key concepts to know
- Crontab fields — minute, hour, day-of-month, month, day-of-week (5 fields for users; 6th user field on system crontab)
- Environment — cron runs with a minimal PATH; use absolute paths or set
PATH=in the crontab - Output — stdout/stderr is mailed to
MAILTOor discarded if unset; redirect to a log file for debugging - Permissions —
/etc/cron.allowand/etc/cron.denycontrol who may use crontab
Learning resources
- crontab(5) — file format — man7.org/linux/man-pages/man5/crontab.5 (official field syntax and special strings)
- crontab(1) — user command — man7.org/linux/man-pages/man1/crontab.1 (install, list, edit crontabs)
- cron(8) — daemon — man7.org/linux/man-pages/man8/cron.8 (Debian/Ubuntu cron daemon behavior)
- Crontab Guru — crontab.guru (interactive cron expression explainer)
Practice scenarios
Hands-on Cron scenarios on live Linux VMs: cron