I want to view the all cron jobs in linux. Whats the command
-
I realize that this is an honest question, but doesn't anyone know how to use google anymore? I've been seeing more and more questions here that took more time to post on serverfault than it would to get an answer from google.– Aaron BrownDec 9, 2009 at 18:41
-
A good lesson on cron is to examine how logrotate works...– djangofanAug 16, 2011 at 23:35
4 Answers
varies by distro, varies by cron software, varies by usage.
this should cover everything on rhel/centos/fedora:
/etc/crontab /etc/cron.d/* /etc/cron.daily/* /etc/cron.hourly/* /etc/cron.monthly/* /etc/cron.weekly/* /var/spool/cron/*
cat /var/spool/cron/*
-
2plus
cat /etc/cron*/*
andcat /etc/crontab
on most modern Unix-like systems.– womble ♦Dec 8, 2009 at 22:34
Another way...
As root, you can use the -u parameter to crontab mixed with -l to view that users crontab entries. Something like this:
cat /etc/passwd |cut -d ":" -f 1 | while read narf; do crontab -u $narf -l; done
That will get every username in your passwd file -- grabbing the first field (-f 1) using ':' as a delimiter (-d ":") with cut, and then calling crontab -u -l for each user in the passwd file.
Often there is also a file /etc/crontab with the system-wide jobs.