What is a cron job?

A cron job is a command your computer runs on a schedule. The scheduler, cron, is a small background service (a daemon) that has been part of Unix since the 1970s and is still on nearly every Linux server.

How cron decides what to run

Cron doesn’t set alarms or count down to the next run. Once a minute it wakes up, reads the current wall-clock time and compares it with every line in every crontab. Any line whose five fields all match that minute gets started. Then cron goes back to sleep.

Step the clock below and watch four real-looking crontab lines being checked. The simulation starts on Friday 13 March 2026, which shows the day-field OR rule in action.

Loading the simulation…

Two things follow from the minute-by-minute check. First, cron has no memory: if the machine is off at 02:30, the backup is simply missed (anacron and systemd timers with Persistent=true exist to catch up). Second, a job that takes longer than its interval will overlap with the next run unless you guard it, for example with flock -n /tmp/job.lock command.

For hands-on learning that sticks, ahaboo walks you through ideas like the Moon's phases, photosynthesis, and how income tax brackets really work.

Anatomy of a crontab line

# m  h  dom mon dow  command
 30  2   *   *   *   /usr/bin/backup --full >> /var/log/backup.log 2>&1

Five schedule fields, then the command, which runs through /bin/sh. The cron syntax guide covers the fields in detail, and the cron expression generator builds and checks them for you.

crontab -e: editing your schedule

CommandWhat it does
crontab -eEdit your crontab (creates it if missing). Cron picks up changes on save; no restart needed.
crontab -lList your current jobs.
crontab -rRemove your whole crontab without asking. Back it up first with crontab -l > cron.bak.
sudo crontab -u alice -eEdit another user’s crontab.
/etc/crontab, /etc/cron.d/System crontabs. These have an extra user column between the schedule and the command.
/etc/cron.daily/ etc.Drop an executable script here to run it daily, hourly, weekly or monthly (via run-parts or anacron).

Why cron jobs fail silently

  • Minimal environment. Cron starts jobs with a short PATH (often just /usr/bin:/bin) and none of your shell profile. Use absolute paths, or set PATH= at the top of the crontab.
  • Percent signs. In a crontab command, % means newline. Write date +\%F.
  • No output capture. Append >> /var/log/job.log 2>&1 so errors are visible.
  • Wrong time zone. The server clock may be UTC. Check with date, and preview runs in that zone with the generator.
  • Missing final newline. Some crons ignore the last line if the file doesn’t end with a newline.

Cron beyond Linux

The same five-field format schedules GitHub Actions workflows, Kubernetes CronJobs and Vercel Cron Jobs. Java schedulers use the six-field Quartz and Spring format, and AWS uses its own EventBridge cron().

Questions

What is a cron job in simple terms?
A command that the computer runs automatically on a schedule, for example a backup script every night at 02:30. "Cron" is the background service that keeps the schedule; each line in a crontab file is one cron job.
How do I open my crontab?
Run crontab -e. It opens your personal crontab in the editor set by $EDITOR (often nano or vi). crontab -l lists it, and crontab -r deletes all of it, so be careful with that one.
Why doesn’t my cron job run?
Common causes: cron runs with a minimal PATH, so use full paths to programs; the script is not executable; % characters in the command need escaping as \%; the file has no newline at the end; or the job runs in a different time zone than you expect. Redirect output to a log file to see errors.
Where do cron job logs go?
Output from a job is emailed to the user if mail is configured, otherwise it is lost. Redirect it yourself: >> /var/log/myjob.log 2>&1. The daemon’s own log is in /var/log/syslog (Debian/Ubuntu), /var/log/cron (RHEL) or journalctl -u cron.
Are cron jobs still used?
Yes. Beyond Linux servers, the same five-field syntax schedules GitHub Actions workflows, Kubernetes CronJobs, Vercel and Netlify functions, and many database and cloud schedulers.