List Your Own Cron Jobs
crontab -l
This prints the crontab of the user you are logged in as. If you have none, it says that there is no crontab for your user. Root has a separate crontab: sudo crontab -l.
List Another User's Jobs
sudo crontab -l -u deploy
To check every account at once:
for u in $(cut -d: -f1 /etc/passwd); do
sudo crontab -l -u "$u" 2>/dev/null | sed "s/^/$u: /"
done
Each job appears with the user name in front. Comment lines appear too; ignore lines that start with #.
System-Wide Cron Files
Packages and administrators also schedule jobs outside user crontabs:
cat /etc/crontab
ls -l /etc/cron.d/
ls -l /etc/cron.hourly/ /etc/cron.daily/ /etc/cron.weekly/ /etc/cron.monthly/
- /etc/crontab: the main system file. Its lines have an extra field, the user to run as.
- /etc/cron.d/: one file per package or task, same format as
/etc/crontab. - cron.daily and the other folders: plain scripts run once an hour, day, week, or month. On many systems, anacron runs the daily, weekly, and monthly ones, so they still run after the server was off at the scheduled time.
On Debian and Ubuntu, scripts in those folders are run by run-parts, which skips file names that contain a dot. A script called backup.sh there never runs; name it backup.
Where User Crontabs Are Stored
| System | Folder |
|---|---|
| Debian and Ubuntu | /var/spool/cron/crontabs/ |
| AlmaLinux and Rocky Linux | /var/spool/cron/ |
sudo ls on that folder shows which users have a crontab. Read them there if you need to, but change them only with crontab -e, which installs the edited file properly so cron picks up the change.
Read a Cron Line
30 2 * * 1 /usr/local/bin/backup >> /var/log/backup.log 2>&1
| Field | Value here |
|---|---|
| Minute | 30 |
| Hour | 2 |
| Day of month | * (any) |
| Month | * (any) |
| Day of week | 1 (Monday) |
This job runs at 02:30 every Monday, in the server's time zone. Shortcuts such as @daily and @reboot replace the five fields.
systemd Timers
Many current packages schedule work with systemd timers instead of cron, for example log rotation and package metadata updates:
systemctl list-timers --all
The list shows the next and last run of each timer and the service it starts. To see what a timer does, run systemctl cat on the timer and on its service. The service side is explained in systemd unit files explained and how to list services with systemctl.
Check That a Job Ran
systemctl status cron # Debian and Ubuntu
systemctl status crond # AlmaLinux and Rocky Linux
journalctl -u cron --since today # use crond on AlmaLinux and Rocky Linux
The journal records each start. Output of a job without redirection is mailed to the user if a mail system is installed, and otherwise lost; redirect it to a log file, as in the example line above. Jobs with @reboot run after a reboot, so test them once by rebooting at a quiet time.
One-Off Jobs with at
Jobs scheduled once with the at command are not in any crontab. List them with atq and show one with at -c followed by its number.