What you will learn
- Write crontab entries
- Understand cron syntax
- Compare with systemd timers
New to this? Start here
The basics, in plain English
Sometimes you want a task to run automatically on a schedule, like a backup every night. cron is the built-in Linux scheduler that runs commands for you at set times, with no human needed.
- Schedule
- A rule for when something should run automatically, like “every day at 2am”.
- cron
- The Linux service that runs commands on a schedule in the background.
- crontab
- The list of scheduled jobs for a user. You edit it to add or change schedules.
- Cron expression
- Five fields (minute, hour, day, month, weekday) that define exactly when a job runs.
- Job
- A single scheduled task: a command plus the time it should run.
01
Time fields
cron uses five fields: minute, hour, day-of-month, month, day-of-week. systemd timers are more powerful for service-tied jobs.
Try it yourself
text
# m h dom mon dow command↳The five time fields: minute, hour, day-of-month, month, day-of-week.0 2 * * * /usr/local/bin/backup.sh↳Run the backup every day at 02:00.*/15 * * * * /usr/local/bin/health.sh↳Run the health check every 15 minutes.↳ lines explain what each command does — only the commands get copied
Finished this topic?
Mark it done to earn 100 XP and keep your streak alive.