LinuxAlternative

Linux · System Tools

cron

Cron is a time‑based job scheduler that runs scripts or commands at specified times or intervals.

Open sourceFree
Be the first to rate
License
GPL-3.0
Latest version
4.1

What is cron?

Cron has been part of Unix since the early 1970s and is available on almost every Linux distribution, including Debian and Ubuntu. It lets users schedule tasks by editing a simple text file, the crontab, which lists commands and their execution times. The tool is mature, stable, and widely documented.

Cron is aimed at system administrators and power users who need reliable, unattended automation. It is also useful for developers who want to run tests or backups at regular intervals.

Compared with Windows Task Scheduler, cron feels more lightweight and script‑centric. It lacks a graphical interface by default, but most users prefer the control and transparency of editing a plain text file.

Best for: Automating routine system tasks such as backups, log rotation, and periodic scripts.

Key features of cron

  • Text‑based crontab syntax
  • Supports minute, hour, day, month, weekday scheduling
  • Runs under any user’s crontab
  • Can redirect output to files or mail
  • Handles environment variables
  • Supports @reboot, @yearly, @monthly, @weekly, @daily, @hourly

Pros

  • Free and open source
  • Highly reliable and battle‑tested
  • No GUI overhead
  • Works in headless environments
  • Extremely configurable

Cons

  • No built‑in GUI (unless using third‑party tools)
  • Learning curve for crontab syntax
  • Limited debugging tools
  • No native support for complex event triggers

Windows programs cron replaces

How to install cron on Linux

Ubuntu / Mintsudo apt install cron
Debiansudo apt install cron

Tips for Windows users

Windows Task Scheduler uses XML task files; cron uses plain text crontab files. There is no direct file format conversion. Instead, create a new crontab entry: * * * * * /path/to/command. Use crontab -e to edit. Shortcuts differ: Windows uses a GUI to set triggers; in cron you set the schedule directly in the crontab. Workflow changes: you’ll need to test scripts manually and rely on email or log files for output, rather than the Task Scheduler’s graphical status reports.

cron: frequently asked questions

How do I edit my crontab?

Run crontab -e to open the crontab in your default editor. Each line is a separate job.

Can I run cron jobs as root?

Yes, edit /etc/crontab or use sudo crontab -e for the root user. Be careful with permissions.

How does cron handle output?

By default, cron sends the output of a job to the user’s mailbox. You can redirect output with > /path/file 2>&1.

What if my cron job fails?

Check the mail for errors or redirect errors to a log file. Use cron logs in /var/log/syslog or /var/log/cron.

Updated