Linux task scheduling using crontab

When working on Linux, if you ever start working on a website that is quite loaded on the side of your web server, then at this time you may also want to start some processes, such as thumbnail creation and data improvement on the back panel. end, allowing you to stop stopping the user from interfering. To make it easier to use, Linux also has a great program that you can use as hronCron helps us to automatically run a task in the backend in a specific sequence of regular intervals. Cron has many other uses, such as automatic backups, it is also used to synchronize files, it can be used to update schedules, etc. In this guide, you will first use the Linux command line to see how it works, and in next section. , we will see a graphical interface for creating Cronjobs.

Linux crontab

Crontab is mainly used to view commands and further plan commands so that they can be executed periodically. To use this command, we need to complete the following steps.

Step 1: First of all, open the terminal by clicking on Ubuntu Launcher and find the terminal.

Linux terminal search

Step 2: Now click on Terminal and wait for the terminal to open.

Open the Terminal app

Linux task scheduling using crontab

Step 3: After opening the terminal you will have the following screen:

Linux terminal is ready

Step 4:

To check which crontabs are currently running on our system, we will use the command “Sudo crontab –l.”

Show contents of crontab

Enter the required credentials.

Enter your password

As you can see, we do not have crontabs for this directory because crontab was not created for this root user.

The root crontab is not yet installed

To open crontab in our default editor, we use the command, crontab-e.

Edit crontab

Enter the required credentials.

Enter your password

If this is your first time using crontab, you need to select one editor.

Select crontab editor

You can choose any according to your desire. Tasks running in the background will appear.

Crontab is ready for editing

If you are using it for the first time, select the Nano Editor. You can find the Nano text editor, which is defined by the “GNU nano” heading located at the top of the terminal window. In case you do not, crontab will probably be opened in the vi text editor.

Crontab opened in vi text editor

And if you are not comfortable using vi, you can easily quit in vi. After pressing Enter, you can close it.


We can use the arrow keys / page down keys to scroll to the bottom of the crontab file in Nano. All lines starting with # are “comment lines”. These comments are useful for people who edit files, providing important information about their use.

The lines recorded in the crontab file have the following sequence and have the following valid values:

1) minute (0-59)

2) hour (0-23)

3) day (1-31)

4) month (1-12)

5) day of the week (0-6)

6) command

Add New Cronjob

We used the * character to match any value. Now, if we want the / usr / bin / example command to say 12:30 every day at a predetermined time, then this is what we will do. We will use 29 0 * * * / usr / bin / example. We have zero here, because the hour starts from zero, and the day starts from 1.

So, here is how we plan a specific task.

Saving crontab

We use Ctrl + O to save the file to crontab in nano.

Save crontab

Scheduling Cron Jobs Using the GUI

Step 1:

To do this, simply go to the command line and enter the following command, “Sudo apt-get update && sudo apt – get install gnome-schedule.” After that, he will ask for credentials, as soon as we enter them, the GNOME schedule will start to be set. This method is much simpler because we just need to enter the required fields. So, after installing it, you can see how useful it is to schedule cronjobs using Gnome scheduling.

Set Gnome Schedule

Linux task scheduling using crontab

Permission will be requested, so press Y to continue.

Gnome schedule app installs

Step 2:

After a while, the GNOME graph was installed. It will be displayed as scheduled tasks in system applications.

Search for Gnome Schedule Application

Step 3:

By double-clicking, we get the “Configure Scheduled Tasks” window.

Customize Scheduled Tasks

Step 4:

We see the “New” field in the screenshot above. Click on it, and then select Recurrent Task from the drop-down menu.

Create Scheduled Task

In the window above, we need to fill out all the requested information, which is required to create a new work. This information will be:

  1. Job Description (or may be the name for the job)
  2. Command (can be any that we want to run as a repeating task)
  3. Behavior (if we want to limit the output of the command)
  4. Basic (includes information about the task, whether it will be performed every minute or hour, or per day, per week or every month)
  5. Optional (this includes if we want to schedule work for a predetermined time).

When looking at the bottom of this window, the bottom appears with the words “Add as template”. means we can add work as a template. If this is work, then we can certainly base other vacancies on it. When creating template tasks, we can ultimately create many tasks based on this template. To do this, we just need to click “new-dropdown”, as we did earlier, and then we click on the choice from the template.

If we want to create cron jobs, sudo permissions are also required to run. So, we open the terminal window and then run the command sudo gnome chart, Then we plan the work as described above.


In this tutorial, we discussed how to schedule tasks using crontab. The first part of the tutorial is based on the methods used on the command line. Whereas the second part, which seems much easier to use, is for GUI-based Cron jobs that can be made to work by setting up a Gnome schedule, as shown in this guide.

Linux task scheduling using crontab