Cron + Crontab Cheat Sheet — Quick Reference Guide

Everything you need to know about cron syntax, crontab files, systemd timers, and scheduling jobs on Linux. Keep this page bookmarked — you'll need it every time you set up a cron job.

Cron Expression Format

Open Cron Builder Tool
minute hour day-of-month month day-of-week
*         *         *         *         *
Minute (0-59)
0-59
Hour (0-23)
0-23
Day of Month (1-31)
1-31
Month (1-12 or JAN-DEC)
1-12
Day of Week (0-7 or SUN-SAT)
0-7 (0 and 7 = Sunday)

Special Characters

Character Meaning Example
* Any / every value
* * * * *
Every minute of every hour of every day
, List of values
0 9,18 * * *
At 9:00 AM and 6:00 PM every day
- Range of values
0 9-17 * * *
Every hour from 9:00 AM to 5:00 PM, every day
/ Step interval
*/15 * * * *
Every 15 minutes (:00, :15, :30, :45)
@reboot Run once at startup
@reboot /path/to/script
Runs once when the system boots
@yearly Once a year (Jan 1, 00:00)
@yearly /path/to/script
Equivalent to 0 0 1 1 *
@monthly Once a month (1st, 00:00)
@monthly /path/to/script
Equivalent to 0 0 1 * *
@weekly Once a week (Sunday, 00:00)
@weekly /path/to/script
Equivalent to 0 0 * * 0
@daily Once a day (00:00)
@daily /path/to/script
Equivalent to 0 0 * * *
@hourly Every hour (minute 0)
@hourly /path/to/script
Equivalent to 0 * * * *
No special characters match your search.

Common Cron Examples

Schedule Cron Expression Description
Every minute
* * * * *
Runs 1,440 times per day
Runs at every single minute of every hour, every day.
Every 5 minutes
*/5 * * * *
At :00, :05, :10, :15, :20, :25, :30, :35, :40, :45, :50, :55
Every 5 minutes throughout the day, 288 times daily.
Every 10 minutes
*/10 * * * *
At :00, :10, :20, :30, :40, :50
Every 10 minutes throughout the day, 144 times daily.
Every 15 minutes
*/15 * * * *
At :00, :15, :30, :45 past each hour
Every 15 minutes throughout the day, 96 times daily.
Every 30 minutes
*/30 * * * *
At :00 and :30 past each hour
Twice per hour, 48 times daily.
Every hour
0 * * * *
At :00 past every hour
Once per hour at the top of the hour, 24 times daily.
Every 2 hours
0 */2 * * *
At midnight, 2am, 4am, 6am, 8am, 10am, noon, 2pm, 4pm, 6pm, 8pm, 10pm
Every 2 hours at the top of the hour.
Every 6 hours
0 */6 * * *
At midnight, 6am, noon, 6pm
Four times per day at 6-hour intervals.
Every day at midnight
0 0 * * *
Once daily at 12:00 AM
Runs at midnight every night.
Every day at 9am
0 9 * * *
Once daily at 9:00 AM
Every morning at 9 o'clock.
Twice daily at 9am & 6pm
0 9,18 * * *
At 9:00 AM and 6:00 PM every day
Runs twice per day, morning and evening.
Weekdays at 9am
0 9 * * 1-5
Monday through Friday at 9:00 AM
Business days only, mornings at 9.
Weekends at noon
0 12 * * 0,6
Saturday and Sunday at 12:00 PM
Weekends only at noon.
Every Monday at 9am
0 9 * * 1
Weekly on Monday at 9:00 AM
Once per week on Monday mornings.
First Monday of month
0 9 * * 1
Note: Cron cannot express "first Monday" directly. Use a wrapper script.
See the tip box below for a workaround script.
1st of every month
0 0 1 * *
Monthly on the 1st at midnight
Once per month on the first day.
Every 1st and 15th
0 0 1,15 * *
Twice a month at midnight on the 1st and 15th
Bi-monthly schedule, common for payroll or billing.
Every quarter
0 0 1 1,4,7,10 *
Jan, Apr, Jul, Oct on the 1st at midnight
Quarterly on the first day of each quarter.
New Year's Day
0 0 1 1 *
January 1st at midnight
Once per year on New Year's Day.
Every January 1st at 3am
0 3 1 1 *
January 1st at 3:00 AM
Annual maintenance window, early morning.
Nightly backup at 2am
0 2 * * *
Every day at 2:00 AM
Common backup window during low-traffic hours.
Weekly cleanup Sunday 3am
0 3 * * 0
Every Sunday at 3:00 AM
Weekly maintenance task on Sunday early morning.
Health check every 5 min
*/5 * * * *
Every 5 minutes
Frequent monitoring or uptime check schedule.
DB dump every Friday 1am
0 1 * * 5
Every Friday at 1:00 AM
Weekly database backup on Friday night.
No examples match your search.
Tip: First Monday of Month
Cron cannot directly express "first Monday of month." Use a wrapper script:
#!/bin/bash # Run on the first Monday of each month DAYOfWeek=$(date +\%u) DAYOfMonth=$(date +\%d) if [ "$DAYOfWeek" -eq 1 ] && [ "$DAYOfMonth" -le 7 ]; then /path/to/your/script.sh fi
Schedule the script with: 0 9 1-7 * * (runs daily 1-7 at 9am, script checks if Monday)

Crontab Commands

Command Description
crontab -e
Edit your crontab file in the default editor
crontab -l
List (print) your current crontab entries to stdout
crontab -r
Remove (delete) your entire crontab — use with caution!
crontab -l > ~/crontab-backup.txt
Back up your current crontab to a file
crontab ~/crontab-backup.txt
Restore a crontab from a backup file
crontab -u username -e
Edit another user's crontab (requires root/sudo)
crontab -u username -l
List another user's crontab (requires root/sudo)
systemctl status cron
Check if the cron service is running
systemctl restart cron
Restart the cron daemon (pick up crontab changes)
systemctl enable cron
Enable cron to start automatically on boot
tail -f /var/log/syslog | grep CRON
Watch cron jobs execute in real-time
journalctl -u cron --since today
View cron logs via systemd journal (newer distros)
run-parts --test /etc/cron.hourly
Test which scripts would run from a cron directory
No commands match your search.

Environment Variables in Crontab

Set these at the top of your crontab file (via crontab -e) to control the cron execution environment.

HOME
Home directory for the cron user. Used to resolve relative paths in scripts.
HOME=/home/username
SHELL
Shell used to execute commands. Defaults to /bin/sh. Set to bash for bash features.
SHELL=/bin/bash
PATH
Search path for executables. Cron has a minimal default — often needs to be extended.
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAILTO
Email address for cron output and error messages. Set to "" to disable mail.
MAILTO="admin@example.com"
MAILFROM
Sender address for cron emails (not supported on all systems).
MAILFROM="cron@server.com"
CRON_TZ
Override the timezone for all cron entries in this crontab (supported by some cron implementations).
CRON_TZ=America/New_York
EDITOR
Editor used by crontab -e. Set if you prefer a specific editor.
EDITOR=vim
RANDOM_DELAY
Add a random delay of up to N minutes before execution (Debian/Ubuntu cron feature).
RANDOM_DELAY=5
Example Crontab with Environment Variables
HOME=/home/deploy SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/bin MAILTO="ops@example.com" EDITOR=vim 0 2 * * * /home/deploy/scripts/backup.sh */5 * * * * /home/deploy/scripts/health-check.sh

Output Redirection

Cron sends output via email by default. Redirect stdout and stderr to log files for better debugging and to avoid inbox flooding.

Pattern What it does
/path/to/script.sh > /var/log/script.log
Redirect stdout to a log file (stderr still goes to email)
/path/to/script.sh > /var/log/script.log 2>&1
Redirect both stdout and stderr to a log file
/path/to/script.sh > /dev/null 2>&1
Suppress all output (no email, no log) — useful for quiet jobs
/path/to/script.sh >> /var/log/script.log 2>&1
Append both stdout and stderr to a log file (never overwrites)
/path/to/script.sh >> /var/log/script-$(date +\%F).log 2>&1
Log to a daily-rotated file (e.g., script-2026-06-24.log)
/path/to/script.sh > /dev/null
Suppress stdout; only email on errors (stderr)
/path/to/script.sh 2>&1 | logger -t my-script
Pipe all output to syslog with a tag for easy filtering
No output patterns match your search.
Important: Escape % in Crontab
In crontab files, the % character is special (used for newlines in mail). Escape it as \% in your commands, or use the percent sign inside a script file instead.

Cron to Systemd Timer Conversion

Modern Linux distributions prefer systemd timers over cron. Below are common cron expressions and their systemd timer equivalents.

* * * * * → Every minute
[Unit]
Description=Run every minute

[Timer]
OnCalendar=*:*:0/1
Persistent=true

[Install]
WantedBy=timers.target
*/5 * * * * → Every 5 minutes
[Unit]
Description=Run every 5 minutes

[Timer]
OnCalendar=*:0/5
Persistent=true

[Install]
WantedBy=timers.target
0 * * * * → Every hour
[Unit]
Description=Run every hour

[Timer]
OnCalendar=hourly
Persistent=true

[Install]
WantedBy=timers.target
0 0 * * * → Every day at midnight
[Unit]
Description=Run daily at midnight

[Timer]
OnCalendar=daily
Persistent=true

[Install]
WantedBy=timers.target
0 9 * * * → Every day at 9am
[Unit]
Description=Run daily at 9am

[Timer]
OnCalendar=*-*-* 09:00:00
Persistent=true

[Install]
WantedBy=timers.target
0 9 * * 1-5 → Weekdays at 9am
[Unit]
Description=Run weekdays at 9am

[Timer]
OnCalendar=Mon..Fri *-*-* 09:00:00
Persistent=true

[Install]
WantedBy=timers.target
0 9 * * 1 → Every Monday at 9am
[Unit]
Description=Run weekly on Monday

[Timer]
OnCalendar=Mon *-*-* 09:00:00
Persistent=true

[Install]
WantedBy=timers.target
0 0 1 * * → 1st of every month
[Unit]
Description=Run on 1st of month

[Timer]
OnCalendar=*-*-01 00:00:00
Persistent=true

[Install]
WantedBy=timers.target
Systemd Timer Commands
sudo systemctl daemon-reload # Reload after creating/editing timers sudo systemctl enable --now mytimer.timer # Enable and start a timer systemctl list-timers --all # List all active timers systemctl status mytimer.timer # Check timer status systemctl start mytimer.service # Manually trigger the service once journalctl -u mytimer.service -f # Watch service output

Crontab File Locations

Location Purpose
/etc/crontab System-wide crontab (requires root). Includes a USER field.
/etc/cron.d/ Additional system cron jobs. Package managers drop files here.
/var/spool/cron/crontabs/ User crontabs (edit via crontab -e). Do NOT edit directly.
/etc/cron.daily/ Scripts run once daily by cron.daily runner.
/etc/cron.hourly/ Scripts run once hourly by cron.hourly runner.
/etc/cron.weekly/ Scripts run once weekly by cron.weekly runner.
/etc/cron.monthly/ Scripts run once monthly by cron.monthly runner.

Quick Troubleshooting

Job not running?
1. Check if cron is running: systemctl status cron
2. Verify the script has execute permission: chmod +x /path/to/script
3. Check cron logs: grep CRON /var/log/syslog
4. Make sure there's a newline at the end of your crontab
5. Check MAILTO is set to receive error emails
Wrong time / timezone?
Cron uses the server's local timezone, not UTC. Check with: date or timedatectl.
Ensure the system timezone is correct: sudo timedatectl set-timezone America/New_York
Or set CRON_TZ in your crontab for per-user timezone override.

Frequently Asked Questions

A cron expression is a string of five or six fields that defines a schedule for running commands or scripts automatically on Linux and Unix systems. The five standard fields represent minute, hour, day-of-month, month, and day-of-week. Each field can contain specific values, ranges (1-5), lists (1,3,5), or wildcards (*) to create flexible scheduling patterns.

To run a task every 5 minutes, use the cron expression */5 * * * *. The */5 in the minute field means "every 5 minutes" starting from minute 0. This will execute at :00, :05, :10, :15, :20, :25, :30, :35, :40, :45, :50, and :55 past every hour.

The most common causes are: (1) The server timezone is not what you expect — cron uses the system's local timezone, not UTC. Check with date or timedatectl. (2) The script doesn't have execute permission — run chmod +x /path/to/script. (3) Environment variables differ from your interactive shell — cron has a minimal PATH. (4) There's no newline at the end of your crontab file.

Use the day-of-week field (the 5th field) with values 0-7 where 0 and 7 represent Sunday, 1 is Monday through 6 is Saturday. For example, 0 9 * * 1-5 runs at 9:00 AM Monday through Friday only. You can also use comma-separated values like 0 9 * * 1,3,5 for Monday, Wednesday, and Friday.

Both schedule recurring tasks, but systemd timers are the modern replacement on Linux. Systemd timers offer better logging via journalctl, dependency management, persistent missed runs, and finer-grained scheduling. Cron is simpler and more widely known. For new deployments, systemd timers are recommended; cron remains excellent for straightforward scheduling.

Use Cases

Quick Syntax Reference

Keep this cheat sheet bookmarked as a quick cron syntax reference whenever you need to set up or modify scheduled tasks on Linux servers.

Special Character Reference

Understand cron special characters like asterisk, comma, hyphen, and slash to build complex scheduling patterns with confidence.

Complex Pattern Building

Build complex cron scheduling patterns by combining multiple examples and adjusting them to fit your specific task automation requirements.

Cron Job Debugging

Debug cron job timing issues by referencing common patterns and understanding timezone behavior, escape characters, and output redirection.

DevOps Learning

Learn cron for DevOps tasks including systemd timer conversion, crontab management, environment variables, and log rotation best practices.