How to List Cron Jobs in Linux?

In Linux, the Cron is the system utility that executes different processes at the specified scheduled time.

These scheduled processes are represented as “Cron Jobs”. These jobs execute commands or invoke particular processes, such as deleting cache memory, sending mail, updating security applications, etc., at a specific time.

The aim of this article is to present the various methods to list out “Cron Jobs” in Linux.

The supported content of this guide is as follows:

Let’s start with the first method.

Method 1: Using crontab Utility

The “crontab” utility executes the command at the specified time and date. It lists out the “Minutes”, “Hours”, “Day of Month”, “Months”, and “Day of Weeks” in configuration files.

List All Cron Jobs

To display the list of cron jobs, execute the “crontab” command with the “l” utility as below:

$ crontab -l

List Cron Jobs by Specified User

To display all scheduled cron jobs for a particular username is required. In our case, execute the “crontab” command with the “u” option that refers to the user “itslinuxfoss”:

$ sudo crontab -u itslinuxfoss -l

It navigates to the list of cron jobs in the crontab.

The output shows that the particular user “itslinuxfoss” has only one cron job that invokes at 5: 00 AM every week.

Method 2: Using /etc/cron File

The cron jobs are stored in the “cron” file located in the “etc” directory. Let’s explore the different jobs in the “cron” file:

To List Monthly Cron Jobs

To list out the scheduled cron monthly jobs, the “ls” utility is used to display the content that is stored in the “/etc” directory. The “la” lists all entries stored in the “monthly” file:

$ ls -la /etc/cron.monthly

The output returns the monthly cron jobs of “Apr”, “Dec”, “Oct” and “Mar” of the root user.

List Weekly Cron Jobs

To display the list of cron jobs every week, execute the below script that navigates to the “cron” file:

$ ls -la /etc/cron.weekly

The output returns the scheduled cron jobs every week with the number of processes.

List Daily Cron Jobs

Visualizing the “daily” cron jobs that are located in the “etc” directory is possible through the below command:

$ ls -la /etc/cron.daily

The output shows the scheduled tasks of cron in the listed format.

List Hourly Cron Jobs

In Linux, users can visualize the cron hourly jobs by specifying the particular file “/etc/cron” via the “ls” command:

$ ls -la /etc/cron.hourly

The output displays the cron jobs which have a set hourly basis.

That’s how you can list down cron jobs in Linux.

Conclusion

In Linux, the cron jobs are displayed in listed order by executing the <crontab -l> command. Additionally, cron jobs can be visualized on a “Monthly”, “Weekly”, “Daily” and “Hourly” basis using the “ls” command on the file “/etc/cron.<hourly/daily/weekly/monthly>”. This article has explained possible ways to list the cron jobs in Linux.