Linux Terminal Command: cron

The cron command is an essential tool in System Services & Scheduling. In this tutorial, we will explore what cron does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.


Concept & Explanation

The cron daemon executes commands on a recurring schedule configured in files called crontabs.


Common Options & Syntax

cron [options] [arguments]

Here are the most common flags used with cron:


1. Interactive Example (Simple)

Here is how most people run the command:

# Example
crontab -l

What it does: Lists active cron jobs for the current user.


2. Power-User Example (Advanced)

For scripting and advanced diagnostics, use this configuration:

# Advanced
crontab -e

What it does: Opens your user crontab config file (e.g. 0 4 * * * /backup.sh runs a script daily at 4:00 AM).


⚙️ Warning & Common Pitfalls

[!WARNING] Cron running environment uses a minimal $PATH. Always specify absolute executable paths in your scripts (e.g., use /usr/bin/tar instead of tar).


Here are some related posts on cli_tty1 you might want to check out: