1

I want to view the all cron jobs in linux. Whats the command

Mirage
  • 561
  • 4
  • 10
  • 25
  • 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 Brown Dec 09 '09 at 18:41
  • A good lesson on cron is to examine how logrotate works... – djangofan Aug 16 '11 at 23:35

4 Answers4

4

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/*
cagenut
  • 4,848
  • 2
  • 24
  • 29
2

cat /var/spool/cron/*

Keiran Holloway
  • 1,146
  • 6
  • 13
1

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.

John Ewart
  • 291
  • 2
  • 4
0

In order to be complete, we mustn't forget anacron:

/etc/anacrontab 
Dennis Williamson
  • 62,149
  • 16
  • 116
  • 151