Skip to content
Log In Sign Up info@muvcloud.com

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

SystemFolder
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
FieldValue here
Minute30
Hour2
Day of month* (any)
Month* (any)
Day of week1 (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.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations