Linux Scheduled Tasks: Find Every Cron Job and Timer

Quick Linux Tip #124:

Question: Where ARE all the scheduled tasks on my system?

Try: sudo bash -c 'for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l 2>/dev/null | grep -v "^#\|^$" | sed "s/^/[$user] /"; done'

Info: Enumerates active user crontabs while filtering comments, complementing system-wide cron directories.

Examples:

  • $ sudo systemctl list-timers --all  # Inspect systemd timers (modern cron replacement)
  • $ sudo grep -R '' /etc/cron.* /var/spool/cron/ 2>/dev/null  # Search all cron configurations
  • $ sudo cat /etc/anacrontab  # View scheduled jobs for non-continuously running systems

Note: Remember to check systemd timers as they replace traditional cron. Anacron manages missed jobs for intermittent systems, while /etc/crontab serves as the system master crontab.




LinuxTeck.com
linuxteck:~$ sudo bash -c 'for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l 2>/dev/null | grep -v "^#\|^$" | sed "s/^/[$user] /"; done'
[root] 0 2 * * * /usr/local/bin/backup.sh
[root] 30 3 * * 0 /root/weekly-cleanup.sh
[linuxteck] 0 * * * * /home/linuxteck/scripts/sync.sh
[linuxteck] */15 * * * * /home/linuxteck/bin/check-services.sh
[deploy] 0 1 * * * /opt/app/deploy-staging.sh

linuxteck:~$ ls -la /etc/cron.d/ /etc/cron.hourly/ /etc/cron.daily/ /etc/cron.weekly/ /etc/cron.monthly/
/etc/cron.d/:
total 24
drwxr-xr-x  2 root root  4096 Nov  9 08:00 .
drwxr-xr-x 104 root root 12288 Nov  9 08:00 ..
-rw-r--r--  1 root root   201 Oct 15 10:23 anacron
-rw-r--r--  1 root root   712 Aug 11 14:34 e2scrub_all
-rw-r--r--  1 root root   102 Jan 15 09:00 php

/etc/cron.daily/:
total 28
drwxr-xr-x  2 root root  4096 Nov  9 08:00 .
drwxr-xr-x 104 root root 12288 Nov  9 08:00 ..
-rwxr-xr-x  1 root root   539 Mar 11 08:12 apt-compat
-rwxr-xr-x  1 root root  1478 Nov 23 10:00 dpkg
-rwxr-xr-x  1 root root   375 Jul 03 14:23 logrotate
linuxteck:~$

PREVIOUS ARTICLE Quick Linux Tip #123: Linux Filesystem Check: 3 Commands to Detect Disk Errors NEXT ARTICLE Quick Linux Tip #125: Bash Startup Time: Find and Fix Slow Linux Shell Startup
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.