Skip to main content

crontab Cheatsheet

By Dejan Panovski Updated on Download PDF

Quick reference for scheduling and managing cron jobs with crontab in Linux

Crontab is used to schedule recurring commands and scripts in Linux. This cheatsheet covers cron expression syntax, special strings, common schedules, and crontab management commands.

Cron Format

Use five time fields followed by the command.

FormatDescription
* * * * * commandmin hour day month weekday command
*Any value
,List of values (for example 1,15)
-Range of values (for example 1-5)
/Step values (for example */10)

Time Fields

Valid ranges for each cron field.

FieldAllowed Values
Minute0-59
Hour0-23
Day of month1-31
Month1-12 or JAN-DEC
Day of week0-7 (0 and 7 are Sunday) or SUN-SAT

Special Schedule Strings

Shortcuts for common schedules.

StringDescription
@rebootRun once at startup
@yearlyRun once a year (0 0 1 1 *)
@annuallySame as @yearly (0 0 1 1 *)
@monthlyRun once a month (0 0 1 * *)
@weeklyRun once a week (0 0 * * 0)
@dailyRun once a day (0 0 * * *)
@midnightSame as @daily (0 0 * * *)
@hourlyRun once an hour (0 * * * *)

Common Schedules

Frequently used cron expressions.

ScheduleCron Expression
Every minute* * * * *
Every 5 minutes*/5 * * * *
Every 15 minutes*/15 * * * *
Every hour at minute 00 * * * *
Every day at 02:3030 2 * * *
Every weekday at 09:000 9 * * 1-5
Every Sunday at 03:000 3 * * 0
First day of month at midnight0 0 1 * *
Every 6 hours0 */6 * * *
Every month on day 15 at 06:000 6 15 * *

Crontab Management

Create, list, and remove per-user cron jobs.

CommandDescription
crontab -eEdit current user’s crontab
crontab -lList current user’s crontab
crontab -rRemove current user’s crontab
crontab -u username -lList another user’s crontab (root)
crontab -u username -eEdit another user’s crontab (root)
crontab file.txtInstall crontab from file

Command Patterns

Useful patterns for reliable cron jobs.

PatternDescription
*/5 * * * * /path/script.shRun script every 5 minutes
0 2 * * * /path/backup.sh >> /var/log/backup.log 2>&1Append stdout/stderr to a log
0 1 * * * /usr/bin/flock -n /tmp/job.lock /path/job.shPrevent overlapping runs
@reboot /usr/bin/sleep 30 && /path/startup.shRun shortly after boot
MAILTO=\"admin@example.com\"Send job output by email

Environment in Cron

Define environment values at the top of crontab.

EntryDescription
SHELL=/bin/bashUse Bash for job execution
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/binSet explicit command path
MAILTO=\"\"Disable cron email
CRON_TZ=Europe/SkopjeSet timezone for this crontab

Troubleshooting Checks

Quick checks when jobs do not run.

CheckCommand
Validate cron service statussystemctl status cron or systemctl status crond
Check cron logs (Debian/Ubuntu)grep CRON /var/log/syslog
Check cron logs (RHEL/Fedora)grep CROND /var/log/cron
Check script permissionsls -l /path/script.sh
Test script manually/path/script.sh
Check if @reboot ranjournalctl -u cron --since "today"

Use these articles for complete cron workflows.

GuideDescription
Scheduling Cron Jobs with CrontabFull guide to creating and managing cron jobs
How to List Cron Jobs in LinuxView user and system cron jobs
Cron Jobs Every 5, 10, 15 MinutesReady-made recurring interval examples