Cron name originates from a Greek word Chronos, which is used for time. It is a daemon for the Linux systems to automate the execution of commands or scripts at a specified time intervals.

This tutorial will show you the several options to list all scheduled cron jobs for users on Linux systems.

How to List Cron Jobs of Current User

The default crontab command works for the current logged in user. You can list all the scheduled cron jobs for the current user, execute:

crontab –l 

Output:

List cron jobs

All the user cron jobs are generally located under /var/spool/cron/crontabs directory. A separate file is created for all the user accounts with thier name.

List Cron jobs of Other User

A root or sudo priviledged user can also view scheduled cronjobs of other users. Use -u followed by the username to list all jobs that belong to a specific user.

For example:

sudo crontab –u username –l 

Replace username with the actual username you want to view cron jobs.

List Cron Jobs Running by System

The root user can access and modify the crontab’s of the operating system. You can view the system’s cronjobs by running the following command as root or sudo privileged account.

less /etc/crontab 

Output:

# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )

How to List Hourly Cron Jobs

You can view the /ettc/cron.hourly directory to find all the cron jobs scheduled to run on every hour.

ls -la /etc/cron.hourly 

Output:

total 20
drwxr-xr-x   2 root root  4096 Apr 23  2020 .
drwxr-xr-x 142 root root 12288 Jan 19 15:21 ..
-rw-r--r--   1 root root   102 Feb 14  2020 .placeholder

The above output shows, that there is no cron job schedule to run hourly. You can see a file .placeholder in each directory, which is created to avoid accidental deletion of directory by package manager. When no other file exists in directory.

How to List Daily Cron Jobs

Similarly, you can list all the scheduled job to run on daily basis. Most of the application jobs can be find in this directory.

ls -la /etc/cron.daily 

Output:

total 72
drwxr-xr-x   2 root root  4096 Dec 28 15:28 .
drwxr-xr-x 142 root root 12288 Jan 19 15:21 ..
-rwxr-xr-x   1 root root   311 Jul 16  2019 0anacron
-rwxr-xr-x   1 root root   539 Apr 13  2020 apache2
-rwxr-xr-x   1 root root   376 Dec  5  2019 apport
-rwxr-xr-x   1 root root  1478 Apr  9  2020 apt-compat
-rwxr-xr-x   1 root root   355 Dec 29  2017 bsdmainutils
-rwxr-xr-x   1 root root   384 Nov 19  2019 cracklib-runtime
-rwxr-xr-x   1 root root  1187 Sep  6  2019 dpkg
-rwxr-xr-x   1 root root   377 Jan 21  2019 logrotate
-rwxr-xr-x   1 root root  1123 Feb 25  2020 man-db
-rw-r--r--   1 root root   102 Feb 14  2020 .placeholder
-rwxr-xr-x   1 root root  4574 Jul 18  2019 popularity-contest
-rwxr-xr-x   1 root root   383 Jan  6  2020 samba
-rwxr-xr-x   1 root root   214 Apr  2  2020 update-notifier-common

How to List Weekly Cron Jobs

The weekly cron jobs are scheduled under /etc/cron.weekly directory.

ls -la /etc/cron.weekly 

Output:

total 32
drwxr-xr-x   2 root root  4096 Apr 23  2020 .
drwxr-xr-x 142 root root 12288 Jan 19 15:21 ..
-rwxr-xr-x   1 root root   312 Jul 16  2019 0anacron
-rwxr-xr-x   1 root root   813 Feb 25  2020 man-db
-rw-r--r--   1 root root   102 Feb 14  2020 .placeholder
-rwxr-xr-x   1 root root   211 Apr  2  2020 update-notifier-common

How to List Montly Cron Jobs

All the monthly cron jobs are scheduled under /etc/cron.monthly directory.

ls -la /etc/cron.monthly 

Output:

total 24
drwxr-xr-x   2 root root  4096 Apr 23  2020 .
drwxr-xr-x 142 root root 12288 Jan 19 15:21 ..
-rwxr-xr-x   1 root root   313 Jul 16  2019 0anacron
-rw-r--r--   1 root root   102 Feb 14  2020 .placeholder

How to View Application Specific Cron Jobs

May of applications scheduled cron jobs for regular works. These jobs can be found under hourly, daily, weekly, or monthly cron jobs.

For example, Apache web server created cron job file under /etc/cron.daily. It means the job is executed on daily basis. You can see the cron job content by accessing file content as below:

cat /etc/cron.daily/apache2 

Output:

#!/bin/sh

# run htcacheclean if set to 'cron' mode

set -e
set -u

type htcacheclean > /dev/null 2>&1 || exit 0
[ -e /etc/default/apache-htcacheclean ] || exit 0


# edit /etc/default/apache-htcacheclean to change this
HTCACHECLEAN_MODE=daemon
HTCACHECLEAN_RUN=auto
HTCACHECLEAN_SIZE=300M
HTCACHECLEAN_PATH=/var/cache/apache2/mod_cache_disk
HTCACHECLEAN_OPTIONS=""

. /etc/default/apache-htcacheclean

[ "$HTCACHECLEAN_MODE" = "cron" ] || exit 0

htcacheclean ${HTCACHECLEAN_OPTIONS}    
                -p${HTCACHECLEAN_PATH}  
                -l${HTCACHECLEAN_SIZE}

Conclusion

In this tutorial, you have learned to view, list or display cron jobs on a Linux system. Additinaly, you found details about cron jobs executed on hourly, daily, weekly or monthly basis.