4 Ridiculously Useful Ubuntu Crontab Commands

Crontab in Ubuntu automates shell scripts. Here is my earlier post on this topic. In Ubuntu or any other Linux operating system, the crontab allows for edits only to root users. The sudo users usually are root users.

How to schedule jobs in crontab

Explained the detailed steps that you need to schedule a job in crontab.

Ubuntu Crontab commands

Here are four ridiculously useful commands that you can use while working with Crontab. These are list, edit, backup, and replace commands.

List command

You can view jobs with the list command.

$sudo crontab -l # browse

Edit command

You can edit the Crontab with the edit command.

$sudo crontab -e #edit

Creating jobs in Ubuntu Crontab

To show how to add a cron job, I have added a simple job, which creates a directory at the specified time.

Crontab in Ubuntu The Top Features
Crontab in Ubuntu The Top Features

The explanation for example cron job

The job runs at 15 minutes, at 20 hours, on 30th, July (7th ), and Saturday, execute command is mkdir srini. A directory of srini creates after running this crontab command.

Backup and Replace commands

Backup command

Here is a command you can use to take the backup of Crontab.

Replace command

Taking backup is the best practice before making changes to the Crontab. The following command replaces the current set of jobs with the jobs in the file crontab.new:

$ crontab -r > crontab.new

Timezone in Crontab

Please note that Crontab triggers scripts according to your operating system’s Timezone.


Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.