cron Cheatsheet - Job Scheduling

All essential cron commands organized by use case, with 43+ entries you can copy and run directly. Find the right command fast when you need it.

SysOps·43 commands·Last updated 2026-07-21
Back to SysOps

Schedule Format 7

* * * * * command
Format: min hour day month weekday
*/15 * * * *
Every 15 minutes (step)
0 */2 * * *
Every 2 hours
0 18 * * 0-6
Daily at 18:00 (0-6 range)
10 2 * * 6,7
Sat/Sun at 2:10 (comma list)
0 0 * * 0
Every Sunday at midnight
0 0 1 * *
Monthly on the 1st at midnight

Special Strings 6

@reboot
Run once at boot
@hourly
Hourly (same as 0 * * * *)
@daily / @midnight
Daily (same as 0 0 * * *)
@weekly
Weekly (same as 0 0 * * 0)
@monthly
Monthly (same as 0 0 1 * *)
@yearly / @annually
Yearly (same as 0 0 1 1 *)

System Cron 6

/etc/crontab
System crontab (adds a user column)
/etc/cron.d/
Drop-in task files (same format)
/etc/cron.hourly/
Hourly scripts dir
/etc/cron.daily/
Daily scripts dir
/etc/cron.weekly/
Weekly scripts dir
/etc/cron.monthly/
Monthly scripts dir

User Crontab 7

crontab -e
Edit the current user's crontab
crontab -l
List the current user's jobs
crontab -r
Remove all jobs for the user
crontab -ri
Remove with confirmation prompt
crontab -u user -e
root edits another user's crontab
crontab -u user -l
View another user's jobs
echo "@reboot echo hi" | crontab
Pipe in jobs quickly

Environment 6

SHELL=/bin/bash
Set the shell cron uses
PATH=/usr/local/bin:/usr/bin:/bin
Set PATH (cron's default is minimal)
MAILTO="admin@example.com"
Mail output to an address
MAILTO=""
Disable mail (no output sent)
HOME=/root
Set the HOME dir
CRON_TZ=Asia/Shanghai
Set the cron timezone

Examples 6

0 2 * * * /path/backup.sh
Nightly backup at 2am
*/5 * * * * curl -s https://example.com/health
Health check every 5 minutes
0 9 * * 1-5 mail -s "Report" team@example.com
Email on weekdays at 9am
0 0 1 * * /path/cleanup.sh
Clean temp files monthly
30 3 * * * /usr/bin/logrotate /etc/logrotate.conf
Rotate logs daily at 3:30
0 0 * * 0 /path/weekly-report.sh >> /var/log/report.log 2>&1
Weekly report with logging

Debugging 5

grep CRON /var/log/syslog
Cron log on Debian/Ubuntu
grep cron /var/log/cron
Cron log on RHEL/CentOS
date
Verify the system timezone
systemctl status cron
Check the cron service status
* * * * * echo test >> /tmp/cron-test 2>&1
Debug: write a test line every minute

Tips

  • Format: min(0-59) hour(0-23) day(1-31) month(1-12) weekday(0-6, 0=Sun).
  • * = all, , = list, - = range, / = step.
  • Use absolute paths in scripts or commands may not be found.
  • cron's env is minimal; set PATH explicitly in scripts.
  • Redirect output: command >> /var/log/cron.log 2>&1.
  • Sun = 0 or 7 depending on distro; standardize on 0.

Official References

Commands are compiled from the official docs below. Click to verify the latest usage.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us