Cron Expressions Explained With 12 Examples
October 6, 2026
21 readsIf you've ever set up a backup, a report email or a clean-up job on a server, you've met cron: the scheduler built into Linux and most hosting platforms. You tell it when to run something using a short line of five fields. It's wonderfully compact, and just as easy to get wrong. Is 0 9 * * 1-5 weekdays or weekends? What does */15 mean?
Once you know what each field means, the whole thing becomes readable.
The five fields
A standard cron expression has five fields, separated by spaces:
โโโโโโโโโ minute (0-59)
โ โโโโโโโ hour (0-23)
โ โ โโโโโ day of month (1-31)
โ โ โ โโโ month (1-12)
โ โ โ โ โ day of week (0-6, Sunday = 0)
โ โ โ โ โ
* * * * *
The job runs when all the fields match the current time. So 30 2 * * * means minute 30, hour 2, any day, any month, any weekday, which is 2:30 every night.
The special characters
*means "every". In the hour field it means every hour.,separates a list:1,15means the 1st and the 15th.-is a range:1-5is Monday to Friday in the weekday field./is a step:*/10means every 10th value, and0-30/10means 0, 10, 20 and 30.
That's the entire syntax. Everything else is a combination of these.
12 schedules to copy
* * * * *: every minute*/5 * * * *: every 5 minutes0 * * * *: at the start of every hour0 */2 * * *: every 2 hours, on the hour30 2 * * *: every day at 2:30 AM0 9 * * 1-5: 9:00 AM, Monday to Friday0 8,20 * * *: twice a day, at 8 AM and 8 PM*/15 9-17 * * 1-5: every 15 minutes during working hours on weekdays0 3 * * 0: every Sunday at 3 AM0 0 1 * *: at midnight on the first of every month0 0 1 */3 *: midnight on the first day of every third month (January, April, July, October)0 0 1 1 *: once a year, at midnight on January 1st
Not sure whether your own schedule is right? Build it visually in the Cron Expression Generator, which shows what each choice means in plain words.
The mistakes that bite
Weekday and day-of-month together. If you set both the day of month and the day of week to something other than *, standard cron runs the job when either matches, not both. So 0 0 13 * 5 runs on the 13th and on every Friday, not only on Friday the 13th. If you need "both", add a check inside the script.
Time zones. Cron uses the server's time zone, which is often UTC. A job set for 9 AM runs at 9 AM server time, which might be the middle of the night for you. Check the server setting, and convert times with the Time Zone Calculator.
Steps that don't divide evenly. */7 in the minute field runs at minutes 0, 7, 14 and so on up to 56, and then starts again at 0 on the next hour, so the gap between 56 and 0 is only 4 minutes. For even spacing, choose values that divide the range, like 5, 10, 15, 20 or 30.
Environment differences. Jobs run with a minimal environment, so a command that works in your terminal may fail in cron because it can't find a program. Use full paths to commands and files.
Silent failures. Cron won't tell you a job failed unless you set that up. Redirect the output to a log file, such as appending >> /var/log/myjob.log 2>&1 to the command, so you can see what happened.
Overlapping runs. A job that runs every minute but sometimes takes two minutes will pile up on itself. Add a lock, or lengthen the interval.
Shortcuts and other dialects
Many systems accept readable shortcuts instead of five fields: @hourly, @daily, @weekly, @monthly, @yearly, and @reboot for "once at startup". They're handy for simple cases.
Be aware that cron comes in different dialects. Some schedulers, such as Quartz and Spring, add a seconds field at the start (six or seven fields), and they differ over whether Sunday is 0 or 1. Cloud platforms often have their own variations. If an expression behaves oddly, check which flavor your platform uses.
Testing before you trust it
- Write the schedule in plain words first: "weekdays at 9 AM".
- Translate it into the five fields.
- Check it with a generator or explainer to confirm the translation reads back the way you meant.
- Test the job once by hand with the exact command cron will run.
- Watch the first couple of scheduled runs.
If your job calls an endpoint, you can test the receiving side with the Webhook Tester. And if it processes data files, a formatter like CSV to JSON can help you check the format.
The short version
A cron expression is five fields: minute, hour, day of month, month and day of week. Use * for every, , for lists, - for ranges and / for steps. Remember the server's time zone, the either-or rule for day of month and day of week, and log your output. With those habits, a schedule you can't read today will be easy to read tomorrow.