This article covers how you can list all jobs in crontab for the system, current users, and other users. Sounds good? Let’s get started.
How To List cron Jobs
The crontab lists jobs based on a user, and with an administrator privilege, you may view jobs of another user.
1. Viewing Cron Jobs for Current User
When creating a cron job, specify which user the scheduled job falls under. If no user is specified, the crontab file schedules the job for the currently logged user. In that case, you can use the following command to list the scheduled jobs for the current user:
In the following output, you can note the scheduled jobs listed at the bottom of the file:
2. Viewing All Cron Jobs of Another User
To view the jobs of another user, you use the -u flag followed by their username. Also, you will need administrator privilege for this to work. For instance, the following command views the cron jobs of a user named linuxhint1.
Your target user’s jobs will be displayed in a crontab file like the one shown below:
3. Viewing All cron Jobs as Root
The crontab in the spool directory doesn’t list the jobs for the root user. To view the crontab containing the various jobs for the whole system, open the /etc/crontab file.
The previous output lists all the cron jobs for the entire system. Note that there are four categories of system jobs. The hourly, daily, weekly, and monthly jobs. If you want to edit the system crontab, you can open it using an editor like nano. The command for that would be as shown below. Note that you must be a root user to access the crontab file.
To view all the hourly cron jobs, run the following command:
In the previous output, we have no hourly cron job. By default, you should get a result similar to the one above with two directories and the .placeholder, which helps avoid the accidental deleting of directories on your system by the package manager.
To view the daily cron jobs, use the following command:
You can note the daily jobs for various system processes in the previous output.
Similarly, the following command lists all the weekly cron jobs.
Lastly, you can view the system’s monthly cron jobs using the following command:
We only have one monthly cron job, as shown above.
4. Viewing Cron Jobs for Specific Applications
It’s possible to list the cron jobs for the various applications running on your system. Here, you can choose the category to view the specific application. For instance, the following command views the daily cron job for Google Chrome:
Working with cron to automate scripts and jobs for your Linux system or server is amazing. We’ve covered the various ways you can list all the crontab jobs, including for the current user, another user, and working with root to get system cron jobs. Further, we discussed how you could list the hourly, daily, weekly, and monthly jobs. Try it out and see your cron jobs.