How To Install cron on Ubuntu 22.04

In this tutorial we learn how to install cron on Ubuntu 22.04. cron is process scheduling daemon

Introduction

In this tutorial we learn how to install cron on Ubuntu 22.04.

What is cron

cron is:

The cron daemon is a background process that runs particular programs at particular times (for example, every minute, day, week, or month), as specified in a crontab. By default, users may also create crontabs of their own so that processes are run on their behalf.

Output from the commands is usually mailed to the system administrator (or to the user in question); you should probably install a mail system as well so that you can receive these messages.

This cron package does not provide any system maintenance tasks. Basic periodic maintenance tasks are provided by other packages, such as checksecurity.

There are three methods to install cron on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install cron Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install cron using apt-get by running the following command:

sudo apt-get -y install cron

Install cron Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install cron using apt by running the following command:

sudo apt -y install cron

Install cron Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install cron using aptitude by running the following command:

sudo aptitude -y install cron

How To Uninstall cron on Ubuntu 22.04

To uninstall only the cron package we can use the following command:

sudo apt-get remove cron

Uninstall cron And Its Dependencies

To uninstall cron and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove cron

Remove cron Configurations and Data

To remove cron configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge cron

Remove cron configuration, data, and all of its dependencies

We can use the following command to remove cron configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge cron

References

Summary

In this tutorial we learn how to install cron package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.