Creating a cron job in Linux keeps routine commands running on schedule without leaving a terminal open. That is useful for recurring backups, cleanup tasks, report generation, and other maintenance that should happen at a predictable time.
The standard Linux workflow stores one account's recurring jobs in a personal crontab managed with crontab. Each active line contains five time fields followed by the command, and the daemon that provides cron service, commonly cron or crond, checks those schedules every minute.
Cron jobs run with a smaller shell environment than an interactive terminal, so absolute paths, deliberate output redirection, and explicit environment lines can prevent silent failures. These steps assume a working cron daemon is already installed and started, the schedule follows the daemon's local timezone unless CRON_TZ is set, and any unescaped % inside the command becomes a line break passed to the shell.
Related: How to list cron jobs in Linux
Related: How to automate Linux backups
# m h dom mon dow command */15 * * * * /usr/local/bin/report-health.sh 0 2 * * * /usr/local/bin/backup-home.sh @daily /usr/local/bin/cleanup-temp.sh
The five fields are minute, hour, day of month, month, and day of week. Shorthand forms such as @hourly, @daily, and @reboot are widely supported on Linux.
If both the day-of-month field and the day-of-week field are restricted, cron runs the command when either field matches.
$ crontab -e
The first run may ask which editor to use. Use sudo crontab -e only when the scheduled command truly needs to run as root.
SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAILTO="" * * * * * /bin/date -u +\%Y-\%m-\%dT\%H:\%M:\%SZ >> /tmp/cron-proof.log 2>&1
Use absolute paths for commands, scripts, and log files because cron usually runs with a minimal PATH.
Escape each % inside the command as \% when the command contains date format strings or similar placeholders.
Do not edit files under /var/spool/cron or /var/spool/cron/crontabs directly. The crontab command installs the entry in the correct format for the current account.
$ crontab -l SHELL=/bin/sh PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin MAILTO="" * * * * * /bin/date -u +\%Y-\%m-\%dT\%H:\%M:\%SZ >> /tmp/cron-proof.log 2>&1
Saving the file is normally enough. Linux cron daemons load the updated crontab automatically, so a service restart is not usually required.
Use How to list cron jobs in Linux when the job might belong to another account or a system-wide cron file such as /etc/crontab or /etc/cron.d/.
$ cat /tmp/cron-proof.log 2026-04-14T11:30:01Z
A new timestamp confirms that cron matched the schedule and ran the command successfully.
$ crontab -e
Keep the same schedule and swap only the command, or change the schedule to the real interval after the proof entry has been validated.