← all posts

List all cron jobs for all users on Linux, including the ones crontab -l misses

The usual crontab -l -u loop found 2 of the 9 cron lines on our Debian 13 test box. Where cron jobs actually live on each distro, a script that lists every one with its owner, and the crontab userdel -r leaves behind.

10 min read

You inherited a server. Before you touch it, you want to know what runs on it at night. The answer everyone posts is a loop: crontab -l -u for every user in /etc/passwd.

That loop asks the crontab command, and crontab only knows about per-user crontabs. We set up a test box on Debian 13, then the same one on Fedora 44 and on Alpine 3.22: two users with a crontab, a file in /etc/cron.d, a job in root’s crontab, and one user who was deleted with userdel -r. Then we compared the loop against what cron actually reads.

2 of 9cron lines on our Debian 13 box that the crontab -l -u loop found
0files in /etc/cron.d or /etc/crontab that the loop reads
1crontab userdel -r left on disk, on every distro we tried
5cron lines in every Alpine image, which run only if something starts crond

Short answer

Cron jobs live in two kinds of files. Per-user crontabs sit in a spool directory, one file per user, named after the user. System crontabs are /etc/crontab and /etc/cron.d/*, with the user in the sixth field. On top of that, /etc/cron.daily and its siblings hold scripts that run as root. crontab -l -u only reads the first kind, so as root, read the files directly:

Distro, cron Per-user crontabs System crontabs Periodic scripts
Debian, Ubuntu (cron 3.0pl1) /var/spool/cron/crontabs /etc/crontab, /etc/cron.d /etc/cron.{hourly,daily,…}
Fedora, RHEL, Rocky (cronie) /var/spool/cron /etc/crontab, /etc/cron.d via /etc/anacrontab
Alpine (BusyBox crond) /etc/crontabs none, /etc/cron.d is ignored /etc/periodic/*

The script below prints every job from all of those with the file it came from and the user it runs as. If you’d rather not keep a script around, RunWisp, an open-source cron replacement that ships as a single binary, reads the same files: sudo runwisp takeover --dry-run counts the jobs and names the crontabs they came from, without changing anything.

The loop everyone posts, and what it misses

for u in $(getent passwd | cut -d: -f1); do
    crontab -l -u "$u" 2>/dev/null | sed "s/^/$u: /"
done

Use getent passwd rather than cut -d: -f1 /etc/passwd, so users from LDAP or SSSD are included. On our Debian 13 box it printed this:

root: 15 4 * * 0 /usr/local/bin/rotate-certs
alice: */5 * * * * /home/alice/sync.sh

Two jobs. The box had nine cron lines, plus three scripts in /etc/cron.daily. What the loop can’t see:

  • /etc/crontab and /etc/cron.d/*. These aren’t anybody’s crontab as far as crontab is concerned. On Debian, /etc/crontab is where the hourly, daily, weekly and monthly runs come from. On a server where someone installed a package with its own cron job, or dropped a file into /etc/cron.d by hand, those are often the jobs you were looking for.
  • The periodic directories. A script in /etc/cron.daily is one run-parts line in /etc/crontab (or /etc/anacrontab on Fedora). The scripts themselves are never listed.
  • Crontabs whose user is gone. crontab -l -u carol answers user `carol' unknown, and the loop never asks anyway, because carol isn’t in getent passwd. Her file is still on disk. More on that below.
  • Anything, unless you’re root. As a normal user, crontab -l -u answers must be privileged to use -u, and on Debian the spool directory can’t even be listed. sudo crontab -l doesn’t help either: that’s root’s own crontab, one file out of many.

One script for every cron file

This reads the files cron reads, skips comments and VAR=value lines, and prints the file, the user the job runs as, and the line. Save it as list-cron-jobs.sh and run it with sudo sh list-cron-jobs.sh. It’s plain sh and awk, so it runs on BusyBox too.

#!/bin/sh
# Every cron job on this machine: file, user it runs as, line. Run as root.

list() { # $1 = file, $2 = user, or empty when the user is in the line
    awk -v f="$1" -v u="$2" '
        /^[ \t]*(#|$)/ { next }                      # comments, blank lines
        /^[ \t]*[A-Za-z_][A-Za-z0-9_]*[ \t]*=/ { next } # MAILTO=, PATH=, ...
        { who = u
          if (who == "") who = ($1 ~ /^@/) ? $2 : $6
          printf "%-34s %-10s %s\n", f, who, $0 }' "$1"
}

# System crontabs: the user is the 6th field.
for f in /etc/crontab /etc/cron.d/*; do
    [ -f "$f" ] && list "$f"
done

# Per-user crontabs: the user is the file name.
# Debian/Ubuntu, RHEL/Fedora, openSUSE, Alpine.
for d in /var/spool/cron/crontabs /var/spool/cron /var/spool/cron/tabs /etc/crontabs; do
    [ -d "$d" ] && [ ! -L "$d" ] || continue
    for f in "$d"/*; do
        [ -f "$f" ] || continue
        u=${f##*/}
        case $u in cron.update | tmp.*) continue ;; esac
        id "$u" >/dev/null 2>&1 || u="$u?"   # no such user: cron skips the file
        list "$f" "$u"
    done
done

# anacron: period, delay, id, command. Runs as root.
[ -f /etc/anacrontab ] && list /etc/anacrontab root

# Scripts in the periodic directories.
for f in /etc/cron.hourly/* /etc/cron.daily/* /etc/cron.weekly/* \
         /etc/cron.monthly/* /etc/periodic/*/*; do
    [ -f "$f" ] && [ -x "$f" ] && printf '%-34s %-10s %s\n' "${f%/*}" root "${f##*/}"
done
exit 0

The same Debian 13 box, this time:

/etc/crontab                       root       17 *	* * *	root	cd / && run-parts --report /etc/cron.hourly
/etc/crontab                       root       25 6	* * *	root	test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
/etc/crontab                       root       47 6	* * 7	root	test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
/etc/crontab                       root       52 6	1 * *	root	test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }
/etc/cron.d/backup                 root       30 2 * * * root /usr/local/bin/backup
/etc/cron.d/backup                 www-data   @reboot www-data /srv/app/warm-cache
/var/spool/cron/crontabs/alice     alice      */5 * * * * /home/alice/sync.sh
/var/spool/cron/crontabs/carol     carol?     0 3 * * * /home/carol/report.sh
/var/spool/cron/crontabs/root      root       15 4 * * 0 /usr/local/bin/rotate-certs
/etc/cron.daily                    root       apt-compat
/etc/cron.daily                    root       dpkg
/etc/cron.daily                    root       exim4-base

A few things the script deals with that tripped us up while writing it:

  • Spool files aren’t clean crontabs. On Debian, each one starts with three # DO NOT EDIT THIS FILE comment lines that crontab -l hides. The comment filter drops them.
  • Alpine has a symlink and a control file. /var/spool/cron/crontabs points at /etc/crontabs, which would list every job twice, and /etc/crontabs/cron.update is a signal file crontab writes for crond, not a user. Both are skipped.
  • tmp.* files are what crontab -e writes while you’re still in the editor.
  • Fedora’s spool files are owned by root, not by the user, so the owner comes from the file name. That’s also how cron decides it.

On Fedora 44 the same box gave /etc/cron.d/0hourly (the hourly run-parts) and three /etc/anacrontab lines instead of Debian’s four /etc/crontab lines. On Alpine, root’s crontab holds the five run-parts /etc/periodic/... lines that every Alpine image ships with.

What the list doesn’t tell you

The script lists what’s on disk. Whether any of it runs is a separate question, and on the boxes we tested the answer was “not all of it”:

Is cron running at all? Check with ps -e | grep -E 'cron|crond'. Every Alpine container has those five lines in /etc/crontabs/root, and debian:trixie-slim has two scripts in /etc/cron.daily, but neither image starts a cron daemon. In a container, cron runs only if the CMD or entrypoint starts it.

Does this cron read that file? Our /etc/cron.d/backup was listed on Alpine too, but BusyBox crond never looks in /etc/cron.d. Debian’s cron skips files in /etc/cron.d with a dot in the name, and lines there without a user field. The cron job not running checklist has those rules, and Debian cron vs cronie vs BusyBox has the differences between implementations.

Is the schedule what you think? 0 9 1-7 * 1 isn’t “the first Monday”. Paste anything unusual into the cron expression checker and pick the cron that runs it.

Did it run, and did it work? Cron logs that it started a job, not how the job ended. Where are cron logs covers what you can find out after the fact.

userdel -r leaves the crontab behind

The carol? line is the one that surprised us. We created carol, gave her a crontab, and removed her with userdel -r, which deletes the home directory and the mail spool. On all three distros the crontab stayed:

Distro Removed with Crontab after
Debian 13 (passwd 4.17.4) userdel -r carol /var/spool/cron/crontabs/carol
Fedora 44 (shadow-utils 4.19.0) userdel -r carol /var/spool/cron/carol
Alpine 3.22 (BusyBox) deluser --remove-home carol /etc/crontabs/carol

While the user doesn’t exist, cron skips the file. Debian’s cron says so when it starts:

cron[3941]: (carol) ORPHAN (no passwd entry)

cronie logs the same ORPHAN line, and BusyBox logs ignoring file 'carol' (no such user). So nothing runs, and nothing looks wrong. Then someone creates a new account called carol. On Debian, the next time cron started, the old crontab ran as the new user. A deploy user removed and re-added by a provisioning script gets its predecessor’s jobs back. A different person who happens to get the same login name gets someone else’s jobs.

The fix is one command, before the user goes:

crontab -r -u carol   # then userdel -r carol

For a user that’s already gone, crontab -r -u refuses with user `carol' unknown, so delete the spool file as root. The ? in the script’s output is there to find these.

Scheduled work that isn’t in a crontab

If the question is “what runs on this box on its own”, cron files are most of it but not all of it.

systemd timers. systemctl list-timers --all lists the system ones. Users can have their own timers under ~/.config/systemd/user/, and those only run while that user’s systemd instance does (logged in, or loginctl enable-linger). As root, systemctl --user -M alice@ list-timers --all shows alice’s, if her instance is running. ls /home/*/.config/systemd/user/*.timer finds the rest.

at jobs. One-off jobs queued with at. atq as root lists every user’s queue.

Containers. The host’s cron files don’t include anything inside a container. The script reads from stdin, so you can run it inside each running container without copying it in:

for c in $(docker ps --format '{{.Names}}'); do
    echo "== $c"
    docker exec -i "$c" sh < list-cron-jobs.sh
done

A container that uses Supercronic instead of cron keeps its crontab wherever its command line points; docker inspect --format '{{.Config.Cmd}}' NAME shows the path.

Application schedulers. One cron line can stand for dozens of jobs. * * * * * php artisan schedule:run is Laravel’s whole scheduler, and php artisan schedule:list shows what’s behind it. An app that schedules in-process, like a Node service using node-cron, doesn’t show up in any crontab at all.

Keeping the list

The script answers the question once. If what you actually want is a list that stays current and says what happened on each run, that’s what we built RunWisp for. It’s an open-source cron replacement that ships as a single binary, and it reads crontabs where they are instead of converting them. Its dry run is a quick inventory on its own. On the Debian 13 box above, with RunWisp 1.10.0:

$ sudo runwisp takeover --dry-run
Found 8 cron jobs on this box:
  /etc/cron.d, /etc/crontab, alice's crontab, root's crontab
...
 ERROR  1 cron source(s) failed to load

/var/spool/cron/crontabs/carol: carol — daemon.include_cron: cron source for user "carol": cannot resolve that account on this machine (user: unknown user carol) — RunWisp cannot confirm the file belongs to whoever its jobs would run as

It found the same jobs as the script (the hourly run-parts line counts as one job, not one per script) and refused to adopt carol’s orphaned crontab. Nothing was written. If you go ahead without --dry-run, it replaces cron as the scheduler, keeps reading the same files (crontab -e keeps working), and the dashboard shows every job’s schedule next to each run’s output and exit code.

The limits: it covers one host, so you still run something per server, and it reads crontabs, not systemd timers or at jobs. The takeover needs Linux with systemd; in a container, use runwisp import cron and run RunWisp as the container’s scheduler instead.

Whichever way you go, run the script on the next box you inherit before you change anything on it. The jobs you didn’t know about are usually in /etc/cron.d.

Common questions

How do I list all cron jobs for all users on Linux?
As root, read the files cron reads instead of asking crontab -l for each user. Per-user crontabs are one file per user, named after the user, in a spool directory: /var/spool/cron/crontabs on Debian and Ubuntu, /var/spool/cron on RHEL and Fedora. Alpine keeps them in /etc/crontabs. System jobs are in /etc/crontab and /etc/cron.d, with the user in the sixth field, and scripts in /etc/cron.daily and its siblings run as root. A loop of crontab -l -u over /etc/passwd only covers the first group, and misses crontabs whose user was deleted.
Does sudo crontab -l show every user's cron jobs?
No. It shows root's own crontab and nothing else. Other users' crontabs and the system files in /etc/crontab and /etc/cron.d aren't in it. To read another user's crontab, use sudo crontab -l -u NAME. To see everything, read the spool directory and the system files as root.
Where are user crontabs stored?
On Debian and Ubuntu in /var/spool/cron/crontabs/NAME, owned by the user and readable only by them and root. On RHEL, Fedora and Rocky (cronie) in /var/spool/cron/NAME, owned by root. On Alpine (BusyBox crond) in /etc/crontabs/NAME, and /var/spool/cron/crontabs is a symlink to it. Edit them with crontab -e or crontab -u NAME -e rather than by hand.
Does deleting a user delete their crontab?
No. userdel -r on Debian 13 and Fedora 44, and deluser --remove-home on Alpine 3.22, removed the home directory and left the crontab in the spool. Cron skips it while the user doesn't exist (Debian logs ORPHAN (no passwd entry)). Create a new account with the same name and it runs the old jobs as the new user from the next time cron starts. Remove it with crontab -r -u NAME before deleting the user, or delete the spool file afterwards.
Can a normal user see other users' cron jobs?
Not their crontabs. crontab -l -u answers 'must be privileged to use -u' and the spool directory can't be listed. /etc/crontab and the files in /etc/cron.d are usually world-readable, so the system jobs are visible without root.
Is there a tool that lists every cron job on a server in one place?
RunWisp, an open-source cron replacement that ships as a single binary, reads a machine's crontabs where they are. sudo runwisp takeover --dry-run counts the jobs and names the crontabs they came from, flags any it can't run (such as a crontab whose user no longer exists), and changes nothing. If you then let it take over from cron, its dashboard keeps the list along with each run's output and exit code. It covers one host and reads crontabs, not systemd timers or at jobs. The takeover itself needs Linux with systemd.
  1. PM2 cron_restart runs the script immediately: how to stop it

    pm2 start --cron runs your job the moment you start it and again on every reload. We tested PM2 7.1.2 and found three ways to run it only at the cron time.

  2. Cron MAILTO not working? Where cron's email actually goes

    We sent cron mail on Debian, Ubuntu, Fedora and Alpine and traced where it went: /var/mail, syslog, a refused port 25 or nowhere. Then made msmtp deliver it.

Get started
GPL 3.0 · no accounts · free to self-host

Start in 30 seconds. Ship on your terms.

A single Go binary. If it doesn't earn the disk space, rm it. No account, no signup, no catch.

Install in 30 seconds
curl -fsSL https://get.runwisp.com | sh