Automating tasks on Linux is easy with cron. This guide walks you through how to schedule jobs with crontab.

1. Open the Terminal

Use Ctrl + Alt + T to open a terminal window.

2. Edit the Crontab

Run this command to open your personal crontab file:

crontab -e

This opens your user’s cron table for editing.

3. Add a Cron Job

Cron uses this syntax format:

* * * * * command_to_run

Each * represents:

  1. Minute (0–59)

  2. Hour (0–23)

  3. Day of Month (1–31)

  4. Month (1–12)

  5. Day of Week (0–6, where 0 = Sunday)

Example: Run a script daily at 2 AM

0 2 * * * /path/to/script.sh

4. Save and Exit

After editing, save and exit. Cron will automatically install the new job.

5. List Scheduled Jobs

To view your current cron jobs:

crontab -l

6. View Cron Logs

To debug or confirm if your cron job ran, check the system log:

grep CRON /var/log/syslog

Or just tail it live:

tail -f /var/log/syslog

Done!

You’ve now scheduled your first cron job on Ubuntu. Automation FTW!

More From Me