I have a script being run automatically that I can't find in the crontab for the expected users, so I'd like to search all users' crontabs for it.

Essentially I want to run a crontab -l for all users.

6 Answers 6


Well depends on the script but easily you can find your crontab as root with

crontab -l -u <user>

Or you can find crontab from spool where is located file for all users

cat /var/spool/cron/crontabs/<user>

To show all users' crontabs with the username printed at the beginning of each line:

cd /var/spool/cron/crontabs/ && grep . *
  • 1
    Awesome, looking in /var/spool/cron/crontabs/ worked nicely, thanks! Mar 13, 2014 at 22:04
  • 3
    crontab -e -u <user> to edit it works as well
    – vladkras
    Aug 4, 2017 at 11:24
  • 2
    /var/spool/cron/<user> on my Centos 7 host.
    – Bob Stein
    Sep 3, 2019 at 18:49

One liner which lists all users and prints cron for every user:

for user in $(getent passwd | cut -f1 -d: ); do echo $user; crontab -u $user -l; done

This solution:

  • Doesn't require knowing a system specific crontab path (e.g. /var/spool/cron/crontabs/ vs /var/spool/cron/
  • Won't list "orphan" crons, i.e. crons for users that don't exist anymore (and thus are not executed effectively)
  • Note: this works for sh but not bash.
    – Tiw
    Jul 16, 2019 at 7:15
for USER in `cat /etc/passwd | awk -F ":" '{print $1}'`
  echo "this crontab for user : $USER"
  crontab -u $USER -l 2>&1
done >> list_all_cron

Strange need to escape chars on this web site. I think copy paste won't work

Well you got the point : loop all users from /etc/passwd + awk and ask for crontab with crontab -u -l

  • Welcome to the site, and thank you for your contribution. Indeed the backtick is used for in-line comment formatting, making it difficult to use. Still, please note that the backtick format is deprecated anyway for command substitutions, and the $( ... ) format should be used instead. Also, you don't really need to cat a file into awk, just give the file to be read as parameter after the command.
    – AdminBee
    Jun 4, 2020 at 11:24

To filter out comments from only active user crontabs:

for user in $(getent passwd | cut -f1 -d: ); do echo $user; crontab -u $user -l | grep -v "^#"; done

or quick and dirty from both common directories:

grep -v "^#" /var/spool/cron/crontabs/* /var/spool/cron/*
  • Sorry, just tried these out in ubuntu. First one you need to be root first (sudo -i) (you can prob modify the one liner to run the crontab commmand as root). I generally don't like been in a shell as root so I haven't tried this as root to see if it even works, Second one also needs to be run as sudo, so you may want to add that in
    – Rqomey
    Dec 8, 2020 at 9:58
  • While I agree, one should use sudo instead of logging in as root, the question posted starts with 'as root', and all other answers up to this point have assumed root, so I continued that assumption.
    – dgulino
    Dec 8, 2020 at 14:51

In RHEL/OEL you can list the cron jobs created by all users:

#cd /var/spool/cron/
#ls -1

To see root's cronjobs:

#cat root
  • The crontab(1) interface (command) should be used, as it protects against concurrent editing of the crontab database.
    – Dirk
    Jan 10, 2018 at 0:07

Using the following command, we findall Cron jobs, on the specified system.

find /etc/cron* -type f -perm -o+w -exec ls -l {} \;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.