crontab manages a user's cron table: the list of scheduled commands that run at specified times. Cron has been the standard Unix scheduler since the 1970s, though systemd timers are displacing it on modern Linux.
crontab -e # edit your crontab
crontab -l # list current entries
crontab -r # remove your crontab
sudo crontab -u alice -e # edit alice's crontab
Each line is minute hour day month weekday command:
0 3 * * * /usr/local/bin/backup.sh # daily at 03:00
*/15 * * * * /usr/bin/check-queue # every 15 minutes
0 0 * * 0 /usr/bin/weekly-report # Sundays at midnight
@reboot /opt/app/start.sh # at boot
System-wide scheduled jobs live in /etc/cron.d/, /etc/cron.daily/, etc. Output from cron jobs is mailed to the user by default; capture it to a file with >> to avoid a mailbox full of cron noise.
Related terms: systemd, at
Discussed in:
- Chapter 18: Security and Hardening — Scheduled Tasks