Advance

How to List Cron Jobs on Ubuntu 20.04 LTS

How to List Cron Jobs on Ubuntu 20.04 LTS
1
(1)

Cron, which stands for Command Run On, is a software feature for control panels. Cron Jobs is a feature in Linux systems that is responsible for performing a specific operation on a specific schedule completely automatically. This operation can be the execution of a command or a specific program or the execution of a CGI script. For example, the scheduled execution of a PHP file in order to send emails to users will be sent automatically at the specified time, for example, every day at 9:00 am. This is done in the Linux operating system through the Cron job and in the Windows operating system through the Schedule task. In this article, we try to learn you How to List Cron Jobs on Ubuntu 20.04 LTS. You can use the packages available in Eldernode to purchase a Ubuntu VPS server.

Tutorial List Cron Jobs on Ubuntu 20.04 LTS

With Cron Jobs in general, you can schedule and execute routine and repetitive tasks easily and without fully automatic intervention. The commands that are executing in each Cron are calling Cron Jobs. A very important use of Cron Jobs on sites is for user services that with each Cron implementation, emails will be sent to your users or customers to provide the necessary information.

For example, e-mail for information about billing, service block notice, service renewal notice, and service information, all of which can be easily configured and executed with a PHP command. If Cron Jobs is not using, all of these and many other things will have to be done manually and with a lot of time. Follow us in this article to explain how to List Cron Jobs on Ubuntu 20.04 LTS.

Recommended Article: How to Configure Gulp.js on Ubuntu 20.04 [Focal Fossa]

Cron Jobs in Linux

Running Cron Job on Linux has a set of rules and commands that can help you define your Cron Job more easily. In Linux, each Cron Job consists of 5 sections, which are specified as * * * * *. Each of these stars represents the run time. For example, the first star on the right indicates the minute, ie if your Cron defines as * * * * 2, Cron Job executes your command every 2 minutes. The second star means the clock, which can set from 0 to 23.

For example, * * * 12 2 means that every day at 12 o’clock and 2 minutes, the limit you are considering is executing. The third star indicates the days of the month, which can range from 1-31. The fourth star indicates the month of the year, the values ​​of which can be adjusted from 1 to 12. The last star is the day of the week, which can be adjusted from 0 to 6. In the last star, you should note that 0 is Sunday.

How to List Cron Jobs of the current user on Ubuntu

Before starting, it should be note that the default crontab command works for the current user. Use the following command to do this:

crontab –l

Make sure all user Cron Jobs are in the /var/spool/cron/crontabs directory. Also in this path, a separate file is created for all user accounts with their names.

Cron Job of the other user

You learned how to list Cron Jobs of the current user. In this section, we learn how to List the Cron Jobs of the other user. In this case, a user with root or sudo can also view other users’ scheduled Cron tasks. You can use the following command to list all jobs that belong to a specific user. Note that in the following command, you must enter your desired username instead of the username.

sudo crontab –u username –l

How to List Cron Jobs Running by System

You can easily view common system tasks by running the following command as a privileged root or sudo account. In this case, the root user can access the system crontabs and edit and modify them.

less /etc/crontab

Follow us in this tutorial to learn how to list Cron Jobs on an hourly, daily, weekly, and monthly basis.

Tutorial List Hourly Cron Jobs

To view the Cron jobs scheduled for each hour, you can use the following command to go to /ettc/cron.hourly.

ls -la /etc/cron.hourly

The output of the above command is as follows. As you can see, there is no Cron work schedule for hourly execution. Note that you can view a .placeholder file in each directory. These directories are created by the package manager to prevent accidental deletion of the list.

Tutorial List Daily Cron Jobs

As in the previous step, you can list all the scheduled tasks that are performed daily using the following command:

ls -la /etc/cron.daily

Tutorial List Weekly Cron Jobs

The general structure of commands is similar. So you can see as in the previous step using the following command that the weekly Cron jobs are scheduled in the /etc/cron.weekly directory:

ls -la /etc/cron.weekly

Tutorial List Monthly Cron Jobs

Again, similar to the commands mentioned in the previous steps, you can easily list monthly Cron Jobs by running the following command:

ls -la /etc/cron.monthly
Recommended Article: How to List Cron Jobs on Ubuntu 20.04 LTS

Conclusion

As mentioned, Cron is one of the most useful tools in Linux/Unix operating systems and is commonly used for sysadmin-related activities such as backing up or emptying /tmp/ directory directories and more. The Cron service runs in the background and constantly scans /etc/crontab files and /etc/cron/ directories. It also examines the /var/spool/cron/ directory. In this article, we tried to learn How to List Cron Jobs on Ubuntu 20.04 LTS. You can refer to the articles How to Enable Cron Jobs on Cpanel host and configure cron jobs in the DirectAdmin if you want to activate and configure Cron Jobs in Cpanel and DirectAdmin.

How useful was this post?

Click on a star to rate it!

Average rating 1 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

Leave a Reply

Your email address will not be published. Required fields are marked *

We are by your side every step of the way

Think about developing your online business; We will protect it compassionately

We are by your side every step of the way

+8595670151

7 days a week, 24 hours a day