Linux Basic — cron Expressions

1 minute read

cron Expressions

Beyond single values and *, cron supports ranges, lists, and steps.


Ranges: -

# 9 AM to 5 PM, every hour
0 9-17 * * * /opt/work-hours.sh

# weekdays only (Mon–Fri)
0 9 * * 1-5 /opt/weekday-job.sh

Lists: ,

# at 9 AM, noon, and 6 PM
0 9,12,18 * * * /opt/check.sh

# on Jan, Apr, Jul, Oct (quarterly)
0 0 1 1,4,7,10 * /opt/quarterly.sh

Steps: /

# every 15 minutes
*/15 * * * * /opt/frequent.sh

# every 2 hours
0 */2 * * * /opt/bihouly.sh

# every 5 minutes during business hours
*/5 9-17 * * 1-5 /opt/monitor.sh

*/N means “every Nth value”. */15 in the minute field = 0, 15, 30, 45.


Combining

# every 10 minutes, 9 AM–5 PM, weekdays
*/10 9-17 * * 1-5 /opt/office-hours-check.sh

# 6 AM and 6 PM every day
0 6,18 * * * /opt/twice-daily.sh

Examples

Schedule Expression
Every minute * * * * *
Every 5 minutes */5 * * * *
Top of every hour 0 * * * *
Daily at 3:30 AM 30 3 * * *
Sundays at noon 0 12 * * 0
Weekdays at 8 AM 0 8 * * 1-5
1st and 15th at midnight 0 0 1,15 * *

Testing cron Expressions

Use crontab.guru to validate and translate expressions into plain English.


Next → crontab -e & Shortcuts

Updated: