# Cron

> A tool that runs commands on a plan, like each night at 3.

**Field:** Infrastructure  
**Category:** Linux & the Command Line  
**Also known as:** Cron Job, crontab, Cron Daemon, Scheduled Job

## Think of it like

Think of it like an alarm clock that does a chore when it rings.

## Definition

Cron is a daemon that runs commands for you on a set schedule. Each job is one line in a table called a crontab. The line has a time pattern, then the command to run. Cron checks the table every minute and starts any job whose time has come. You edit your own table with crontab -e.

## Example

Emma wants a backup every night. She adds one line to her crontab, and the backup runs at 3 a.m. each day.

## Example code

```console
$ crontab -l
0 3 * * * /home/emma/backup.sh
```

One job: run the backup script at 3:00 every day.

## Why it matters

Backups and clean-ups run on their own. No one has to remember them.

## Common mistake

Assuming a cron job sees the same settings as your shell. It runs with a bare setup, so use full paths.

## Three principles

- **One line per job.** A time pattern and a command.
- **Checks each minute.** Runs what is due.
- **Use full paths.** Cron has a bare setup.

## Related terms

- [Cron Expression](https://learn.benibix.com/term/infrastructure/cron-expression)
- [Daemon](https://learn.benibix.com/term/infrastructure/daemon)
- [systemd](https://learn.benibix.com/term/infrastructure/systemd)
- [Environment Variable](https://learn.benibix.com/term/infrastructure/environment-variable)
- [Background Job](https://learn.benibix.com/term/development/background-job)

## Taught in

- [Cron Jobs and Schedules](https://learn.benibix.com/learn/infrastructure-linux/cron-jobs-and-schedules): Linux CLI, 9/10

![The crontab line 30 9 * * 1-5 /home/jack/report.sh with each part labelled. 30 is the minute, 9 is the hour, the first star is any day of the month, the second star is any month, and 1-5 is Monday to Friday. The path after them is the command to run.](https://learn.benibix.com/diagrams/inf3-cron.svg)

---

Source: https://learn.benibix.com/term/infrastructure/cron
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
