Automating tasks on Linux is easy with cron. This guide walks you through how to schedule jobs with crontab.
Use Ctrl + Alt + T to open a terminal window.
Run this command to open your personal crontab file:
crontab -e
This opens your user’s cron table for editing.
Cron uses this syntax format:
* * * * * command_to_run
Each * represents:
0 2 * * * /path/to/script.sh
After editing, save and exit. Cron will automatically install the new job.
To view your current cron jobs:
crontab -l
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
You’ve now scheduled your first cron job on Ubuntu. Automation FTW!