- How to Display (List) All Jobs in Cron / Crontab
- How to View Jobs in Crontab
- View Daily Cron Jobs
- View Hourly Cron Jobs
- View Weekly Cron Jobs
- View Monthly Cron Jobs
- View /etc/crontab
- How to List, Display, & View all Current Cron Jobs in Linux
- Listing Cron Jobs in Linux
- How to List all Active Cron Jobs Running
- View Cron Jobs by User
- How to List Hourly Cron Jobs
- How to List Daily Cron Jobs
- How to Display Weekly Cron Jobs
- How to List Monthly Cron Jobs
- View Software Specific Cron Jobs
- How can get a list of all scheduled cron jobs on my machine?
- 4 Answers 4
- How To View All Jobs in Crontab?
- How To List cron Jobs
- 1. Viewing Cron Jobs for Current User
- 2. Viewing All Cron Jobs of Another User
- 3. Viewing All cron Jobs as Root
- 4. Viewing Cron Jobs for Specific Applications
- Conclusion
- About the author
- Denis Kariuki
How to Display (List) All Jobs in Cron / Crontab
Servers can automatically perform tasks that you would otherwise have to perform yourself, such as running scripts. On Linux cloud dedicated servers or VPS servers, the cron utility is the preferred way to automate the running of scripts. In this article, we’ll cover how to view the jobs scheduled in the crontab list. For an introduction to Cron, check out our KB How To: Automate Server Scripts With Cron. Knowing how to set up crontab is an important skill, but even if you’re not editing these knowing how to view them is important as well.
How to View Jobs in Crontab
Example with user testuser.
View Daily Cron Jobs
View all the daily cron jobs.
View a specific daily cron job.
less /etc/cron.daily/filename
Example with file name logrotate.
less /etc/cron.daily/logrotate
View Hourly Cron Jobs
First view all the hourly cron jobs.
Then view a specific hourly cron job.
less /etc/cron.hourly/filename
Example with file name 0anacron.
less /etc/cron.hourly/0anacron
View Weekly Cron Jobs
First view all the weekly cron jobs.
Then view a specific weekly cron job.
less /etc/cron.weekly/filename
Example with the file name weeklyexample.
less /etc/cron.weekly/weeklyexample
View Monthly Cron Jobs
First view all the monthly cron jobs.
Then view a specific monthly cron job.
less /etc/cron.monthly/filename
Example with file name readahead-monthly.cron.
less /etc/cron.monthly/readahead-monthly.cron
View /etc/crontab
SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # 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
When a standard Cloud VPS is not enough, Liquid Web’s HIPAA compliant web hosting using our Dedicated Servers are a dream come true. Liquid Web’s server outmatches the competition on performance and support. Check out how our Dedicated Servers can skyrocket your site’s performance.
Video Update by Justin Palmer
How to List, Display, & View all Current Cron Jobs in Linux
Cron is a Linux utility for scheduling scripts and commands. This guide will show you several options to view current cron jobs scheduled in the crontab list.
Listing Cron Jobs in Linux
How to List all Active Cron Jobs Running
To list all scheduled cron jobs for the current user, enter:
Cron jobs are typically located in the spool directories. They are stored in tables called crontabs. You can find them in /var/spool/cron/crontabs. The tables contain the cron jobs for all users, except the root user.
The root user can use the crontab for the whole system.
To display contents of the root user’s crontab, use the less command:
The system returns an output like the following:
# /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 # m h dom mon dow user command 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 )
The /etc/crontab file can be edited using a text editor like nano:
In RedHat-based systems, this file is located at /etc/cron.d.
The /etc/ directory has additional cron subdirectories to organize hourly, daily, weekly, and monthly tasks. The ls (list) command displays files and directories. Use the -la option to list all entries in long format.
View Cron Jobs by User
To list cron jobs that belong to a specific user, run the following command:
sudo crontab -u [username] -l
Replace [username] with the actual username you’re viewing.
How to List Hourly Cron Jobs
To list hourly cron jobs enter the following in the terminal window:
The output should appear similar to this:
How to List Daily Cron Jobs
To list daily cron jobs, enter the command:
The results will look similar to the following output:
How to Display Weekly Cron Jobs
To display weekly cron jobs:
The results will look something like the following:
total 28 drwxr-xr-x 2 root root 4096 Apr 24 20:46 . drwxr-xr-x 96 root root 4096 May 19 17:12 .. -rw-r--r-- 1 root root 102 Feb 9 2013 .placeholder -rwxr-xr-x 1 root root 730 Feb 23 2014 apt-xapian-index -rwxr-xr-x 1 root root 427 Apr 16 2014 fstrim -rwxr-xr-x 1 root root 771 Sep 23 2014 man-db -rwxr-xr-x 1 root root 211 Mar 27 2017 update-notifier-common
How to List Monthly Cron Jobs
To display monthly cron jobs use the ls command in this format:
total 12 drwxr-xr-x 2 root root 4096 Apr 24 20:44 . drwxr-xr-x 96 root root 4096 May 19 17:12 .. -rw-r--r-- 1 root root 102 Feb 9 2013 .placeholder
View Software Specific Cron Jobs
To view software specefic cron tasks, start by viewing a list of cron tasks:
Use the cat command to display the contents of update-notifier-common :
The results will look similar to:
#!/bin/sh set -e [ -x /usr/lib/update-notifier/package-data-downloader ] || exit 0 # Try to rerun any package data downloads that failed at package install time. /usr/lib/update-notifier/package-data-downloader
Note: You should also learn more about Linux at command, another useful tool for scheduling jobs.
Now you know how to navigate through the cron jobs on your machine. Cron is a helpful utility for scheduling tasks such as running a job at reboot. Use the commands from this guide to sort and display tasks scheduled through the cron tool.
How can get a list of all scheduled cron jobs on my machine?
My sysadmin has set up a bunch of cron jobs on my machine. I’d like to know exactly what is scheduled for what time. How can I get that list?
This isn’t the answer to the question, but just a note on best practices. One can configure these as per-user cron jobs for root or apache or whatever, but one should use /etc/crontab or (better, in most distros) /etc/cron.d and /etc/cron.[timeframe] .
I have posted a script which automates this to a useful degree at: — stackoverflow.com/questions/134906/… It’s not perfect but probably covers 90% of the needs. It is a good example of what not to write in bash.
4 Answers 4
With most Crons (e.g. Vixie-Cron — Debian/Ubuntu default, Cronie — Fedora default, Solaris Cron . ) you get the list of scheduled cron jobs for the current user via:
To get the crontabs for all users you can loop over all users and call this command.
Alternatively, you can look up the spool files. Usually, they are are saved under /var/spool/cron , e.g. for vcron following directory
contains all the configured crontabs of all users — except the root user who is also able to configure jobs via the system-wide crontab, which is located at
With cronie (default on Fedora/CentOS), there is a .d style config directory for system cron jobs, as well:
(As always, the .d directory simplifies maintaining configuration entries that are part of different packages.)
For convenience, most distributions also provide a directories where linked/stored scripts are periodically executed, e.g.:
/etc/cron.daily /etc/cron.hourly /etc/cron.monthly /etc/cron.weekly
The timely execution of those scripts is usually managed via run-parts entries in the system crontab or via anacron.
With Systemd (e.g. on Fedora, CentOS 7, . ) periodic job execution can additionally be configured via timer units. The enabled system timers can be displayed via:
Note that users beside root may have user systemd instances running where timers are configured, as well. For example, on Fedora, by default, a user systemd instance is started for each user that is currently logged in. They can be recognized via:
$ ps aux | grep 'systemd[ ]--user'
Those user timers can be listed via:
$ systemctl --user list-timers
An alternative to issuing the list-timers command is to search for timer unit files (pattern: *.timer ) and symbolic links to them in the usual system and user systemd config directories:
$ find /usr/lib/systemd/ /etc/systemd -name '*.timer' $ find /home '(' -path '/home/*/.local/share/systemd/user/*' \ -o -path '/home/*/.config/systemd/*' ')' \ -name '*.timer' 2> /dev/null
(As with normal service units, a timer unit is enabled via creating a symbolic link in the right systemd config directory.)
How To View All Jobs in Crontab?
Servers can be set to perform tasks or run scripts automatically. In Linux, you can use the cron utility to configure the task or scripts your server should run at a specified time. Any cron jobs on your server are located in the spool directories in the /var/spool/cron/crontabs. The crontab lists all cron jobs for users, excluding the root user. However, if you need to view the cron jobs of the entire system, you must be a root user.
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:
Conclusion
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.
About the author
Denis Kariuki
Denis is a Computer Scientist with a passion for Networking and Cyber Security. I love the terminal, and using Linux is a hobby. I am passionate about sharing tips and ideas about Linux and computing.