Crontab is managed through four main commands: crontab -e to edit, crontab -l to view, crontab -r to remove, and crontab -u to manage another user's crontab as root. This episode also maps /etc/crontab, /etc/cron.d/, and the per-user spool in /var/spool/cron/.

In episode 3 you mastered the five-field syntax. Now it's time to touch what you'll do most often day to day: managing the crontab file — adding schedules, viewing existing ones, fixing them, and removing them.
Most admins spend their time with four commands: crontab -e, crontab -l, crontab -r, and crontab -u. Master these four, plus understand where the files actually live, and you've covered 90% of daily cron operations.
Displays the active user's crontab:
crontab -lIf there's no crontab yet, the command shows "no crontab for <user>". Use crontab -l 2>/dev/null if you want to hide that message in scripts.
Opens the crontab in your editor (the one set via EDITOR from episode 0):
crontab -eThe editor opens a temporary file; save and close it, and crontab validates the syntax before saving. If there's an invalid line, cron refuses to save and shows a message — safe from fatal mistakes.
Removes the entire user crontab:
crontab -rCaution
crontab -r removes everything without confirmation. Always back up first: crontab -l > ~/crontab-backup.txt before removing, or use crontab -i to request interactive confirmation.
As root, you can manage other users' crontabs:
sudo crontab -u deploy -l
sudo crontab -u deploy -eThis is useful when creating dedicated crontabs for service accounts — for example a backup user that runs backup scripts (we'll cover this in episodes 10 and 13).
A very useful combination in automation: load the crontab from a file, or save it to a file for versioning:
crontab /path/to/my.crontab
crontab -l > crontab-saved.txt
crontab crontab-saved.txtWith this pattern, your entire schedule can live in a Git repository — a free audit trail for schedule changes.
crontab -e writes the user's schedule to the spool directory:
/var/spool/cron/crontabs/<username>Don't edit files here directly — always go through crontab so the format and permissions stay correct.
The global schedule file with a user field (see episode 2):
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
25 6 * * * root test -x /usr/sbin/anacron && /usr/sbin/anacronA directory containing schedule files in the same format as /etc/crontab. Packages like logrotate put their schedules here:
ls /etc/cron.d/
cat /etc/cron.d/logrotateBecause /etc/cron.d/ is handled by cronie, each new file will be read without restarting the daemon.
| Approach | User field? | Used for | Editable via |
|---|---|---|---|
crontab -e | No | Personal user schedules | crontab command |
/etc/crontab | Yes | Global system schedules | Editor + root |
/etc/cron.d/ | Yes | Package/component schedules | Editor + root |
-r: crontab -l > backup.txt.crontab file.# to explain the purpose of a schedule.Note
A crontab edited with crontab -e is re-read by crond immediately — no daemon restart needed. This differs from some other services that require a reload after configuration changes.
Key takeaways:
crontab -l views, -e edits, -r removes, -u targets other users.crontab -r — there's no confirmation by default.crontab file.crontab for versioning./var/spool/cron/crontabs/./etc/crontab and /etc/cron.d/ are system schedules with a user field.In episode 5 we'll cover output, mail, and logging — where job output goes, how MAILTO works, redirecting to a log file with >> /var/log/cron.log 2>&1, and per-job logging best practices. This is the key to making sure a failed job doesn't "quietly disappear"!