Cron Cheatsheet - Cron Expression & Task Scheduling Reference
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.
Back to SysOpsExpression Format 6
* * * * * commandStandard format: 5 fields (minute hour day month weekday)
Minute (0-59)Field 1: minute of the hour (0-59)
Hour (0-23)Field 2: hour of the day (0-23); 0 is midnight
Day of month (1-31)Field 3: day of the month (1-31)
Month (1-12)Field 4: month of the year (1-12)
Day of week (0-7)Field 5: day of the week (0 and 7 both mean Sunday; 1-6 are Mon-Sat)
Special Characters 6
*Any value; no restriction on this field
*/NEvery N units, e.g. */5 means every 5 minutes
A-BRange, e.g. 9-17 means every unit from 9 to 17
A,B,CList, e.g. 1,3,5 means Monday, Wednesday, Friday
A-B/NStep within a range, e.g. 1-10/2 means 1,3,5,7,9
LLast, e.g. 0 0 L * * runs on the last day of the month (supported by some implementations)
Special Time Macros 6
@rebootRun once at system startup; commonly used to start background services
@yearly / @annuallyRun once a year, equivalent to 0 0 1 1 *
@monthlyRun once a month, equivalent to 0 0 1 * *
@weeklyRun once a week, equivalent to 0 0 * * 0
@daily / @midnightRun once a day, equivalent to 0 0 * * *
@hourlyRun once an hour, equivalent to 0 * * * *
Common Examples 8
*/5 * * * * commandRun every 5 minutes
0 * * * * commandRun at the top of every hour
0 3 * * * commandRun daily at 3 AM
0 0 * * 1 commandRun weekly on Monday at midnight
0 0 1 * * commandRun monthly on the 1st at midnight
0 9-18 * * 1-5 commandRun every hour on weekdays from 9 AM to 6 PM
*/30 * * * * commandRun every 30 minutes
0 0 * * 0 commandRun weekly on Sunday at midnight
Environment Variables 6
SHELL=/bin/bashShell used to execute cron commands
PATH=/usr/local/bin:/usr/bin:/binCommand search path; cron's default PATH is minimal
MAILTO="admin@example.com"Send command output via email to the given address
MAILTO=""Disable email notifications (send no output)
HOME=/home/userSet the HOME directory for execution
CRON_TZ=Asia/ShanghaiSet the timezone cron uses
Permissions 6
/etc/cron.allowWhitelist: only users listed here may use crontab
/etc/cron.denyBlacklist: users listed here are forbidden from using crontab
crontab -u user -eEdit a specific user's crontab (as root)
crontab -u user -lShow a specific user's scheduled tasks
crontab -u user -rDelete all of a specific user's scheduled tasks
ls /var/spool/cron/Show where each user's crontab file is stored
Troubleshooting 5
grep CRON /var/log/syslogShow cron execution logs on Debian/Ubuntu
grep cron /var/log/cronShow cron execution logs on RHEL/CentOS
systemctl status crondCheck the cron service state (RHEL/CentOS)
systemctl status cronCheck the cron service state (Debian/Ubuntu)
* * * * * echo test >> /tmp/cron-test 2>&1Debug: write a line every minute to test if cron works
Tips
- cron's environment differs from an interactive shell; PATH may be incomplete — export PATH explicitly in your script if commands aren't found.
- Use absolute paths for commands to avoid cron failing to locate executables, especially interpreters like node or python.
- Output is emailed by default; redirect to a log file instead, e.g. command >> /var/log/job.log 2>&1.
- Specifying both day-of-month and day-of-week is an OR relationship, not AND — 0 0 13 * 5 means the 13th OR every Friday.
- No need to restart cron after editing crontab; changes take effect on save, but the script itself must be executable.
- If both cron.allow and cron.deny exist, only allow is consulted; if neither exists, the distribution's default policy applies.
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