Back to Blog
Tutorial

Cron Operators Explained: Mastering the Asterisk (*), Slash (/), Comma (,), and Hyphen (-)

Complete guide to cron syntax operators. Learn what *, /, , and - actually mean in cron expressions with clear examples. Master cron syntax once and for all.

12 min read
By Cron Generator Team

Cron expressions look cryptic at first glance. What does */15 * * * * mean? How is 0 9-17 * * 1-5 different from 0 9,17 * * 1,5?

The confusion comes from four special characters that modify how cron interprets timing: the asterisk (*), slash (/), comma (,), and hyphen (-).

This guide explains each operator in detail with clear examples. By the end, you'll read cron expressions like documentation—instantly understanding what they mean and how to write your own.

Cron Expression Format: A Quick Refresher

Before diving into operators, let's review the basic cron format:

* * * * *
│ │ │ │ │
│ │ │ │ └─── Day of Week (0-7, where 0 and 7 = Sunday)
│ │ │ └───── Month (1-12)
│ │ └─────── Day of Month (1-31)
│ └───────── Hour (0-23)
└─────────── Minute (0-59)

Each position accepts:

  • Numbers - Specific values (5, 23, 12)
  • Operators - Special characters that modify behavior (*, /, ,, -)

Now let's master each operator.

The Asterisk (*): "Every" or "Any"

The asterisk is the wildcard operator. It means "every possible value" or "any value" for that position.

Syntax

*

What It Means

When you use * in a position, you're saying:

  • "I don't care about this value"
  • "Match every possible value"
  • "Run regardless of this field"

Examples

Example 1: Every Minute

* * * * *

Translation: "Every minute of every hour of every day of every month on every day of the week."

Plain English: Runs every single minute, 24/7.

Example 2: Every Hour at Minute 0

0 * * * *

Translation: "At minute 0 of every hour."

Plain English: Runs at the top of every hour (12:00 AM, 1:00 AM, 2:00 AM, etc.).

Example 3: Every Day at Midnight

0 0 * * *

Translation: "At minute 0 of hour 0 (midnight) of every day."

Plain English: Runs once daily at 12:00 AM.

Example 4: Every Monday at 9 AM

0 9 * * 1

Translation: "At minute 0 of hour 9 on every Monday."

Plain English: Runs every Monday at 9:00 AM.

Notice how * in the day-of-month and month positions means "ignore these fields—just match the day of week."

Key Insight: Asterisk = "Don't Care"

Think of * as a blank check. You're telling cron:

  • "I don't care what minute it is" → * * * * *
  • "I don't care what day of the month it is" → 0 9 * * 1
  • "I don't care what month it is" → 30 14 15 * *

Common Asterisk Patterns

| Expression | Meaning | Frequency | |------------|---------|-----------| | * * * * * | Every minute | 1,440 times/day | | 0 * * * * | Every hour (on the hour) | 24 times/day | | 0 0 * * * | Every day at midnight | Once/day | | 0 0 * * 0 | Every Sunday at midnight | Once/week | | 0 0 1 * * | First day of every month at midnight | 12 times/year |

The Slash (/): "Every X" (Step Values)

The slash operator defines step values or intervals. It means "every X" where X is the number after the slash.

Syntax

*/X
or
start-end/X

What It Means

The slash divides a range into steps:

  • */5 means "every 5 units"
  • 0-30/5 means "every 5 units from 0 through 30"
  • */1 is the same as * (every single unit)

How It Works Internally

When cron sees */X, it:

  1. Starts at the minimum value for that field (0 for minutes, 1 for months, etc.)
  2. Increments by X each time
  3. Stops at the maximum value for that field

Example: */15 in the minute position:

  • Start: 0
  • Step: +15
  • Values: 0, 15, 30, 45
  • Stop: 59 (next would be 60, which doesn't exist)

Examples

Example 1: Every 15 Minutes

*/15 * * * *

Translation: "Every 15 minutes."

Execution Times:

  • 12:00, 12:15, 12:30, 12:45
  • 1:00, 1:15, 1:30, 1:45
  • (Repeats every hour)

Plain English: Runs 4 times per hour, 96 times per day.

Example 2: Every 5 Minutes

*/5 * * * *

Execution Times: 0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 (every hour)

Plain English: Runs 12 times per hour, 288 times per day.

Example 3: Every 2 Hours

0 */2 * * *

Translation: "At minute 0 of every 2nd hour."

Execution Times: 12:00 AM, 2:00 AM, 4:00 AM, 6:00 AM, 8:00 AM, 10:00 AM, 12:00 PM, 2:00 PM, 4:00 PM, 6:00 PM, 8:00 PM, 10:00 PM

Plain English: Runs 12 times per day at even hours.

Example 4: Every 10 Minutes During Business Hours

*/10 9-17 * * *

Translation: "Every 10 minutes from hour 9 through hour 17."

Execution Times:

  • 9:00, 9:10, 9:20, 9:30, 9:40, 9:50
  • 10:00, 10:10, 10:20, ... (continues)
  • 17:00, 17:10, 17:20, 17:30, 17:40, 17:50

Plain English: Runs every 10 minutes from 9 AM through 5:59 PM.

Example 5: Every Other Day at Noon

0 12 */2 * *

Translation: "At minute 0 of hour 12 on every 2nd day of the month."

Execution Times: 1st, 3rd, 5th, 7th, 9th, 11th, etc. of each month at 12:00 PM

Plain English: Runs approximately every other day.

Common Step Patterns

| Expression | Meaning | Frequency | |------------|---------|-----------| | */5 * * * * | Every 5 minutes | 288 times/day | | */15 * * * * | Every 15 minutes | 96 times/day | | */30 * * * * | Every 30 minutes | 48 times/day | | 0 */6 * * * | Every 6 hours | 4 times/day | | 0 0 */2 * * | Every 2 days at midnight | ~15 times/month |

Important: Step Values Start at Zero

Common Mistake:

*/15 * * * *  # Runs at :00, :15, :30, :45

NOT at: :15, :30, :45, :00 (next hour)

The step always starts from 0 (or the field's minimum value), not from the step value itself.

Using Slash with Ranges

You can combine slash with ranges for more control:

Example: Every 5 Minutes from 9:00 AM to 5:00 PM

*/5 9-17 * * *

Example: Every 10 Minutes, but Only During the First Half-Hour

0-30/10 * * * *

Execution Times: :00, :10, :20, :30 (each hour)

Example: Every 3 Hours from 6 AM to 6 PM

0 6-18/3 * * *

Execution Times: 6:00 AM, 9:00 AM, 12:00 PM, 3:00 PM, 6:00 PM

The Comma (,): "List" or "AND"

The comma operator creates a list of specific values. It means "at this value AND this value AND this value."

Syntax

value1,value2,value3

What It Means

The comma lets you specify multiple discrete values:

  • 1,15,30 means "match 1 OR 15 OR 30"
  • Not a range, just specific values
  • Values don't need to be sequential

Examples

Example 1: Run at Specific Minutes

0,15,30,45 * * * *

Translation: "At minutes 0, 15, 30, and 45 of every hour."

Execution Times: :00, :15, :30, :45 (every hour)

Plain English: Runs 4 times per hour at exactly those minutes.

Note: This is functionally identical to */15 * * * *, but you're explicitly listing the values rather than using a step.

Example 2: Run at 9 AM and 5 PM

0 9,17 * * *

Translation: "At minute 0 of hours 9 and 17."

Execution Times: 9:00 AM and 5:00 PM daily

Plain English: Runs twice daily, at the start and end of the workday.

Example 3: Run on Specific Days of the Month

0 0 1,15 * *

Translation: "At midnight on days 1 and 15 of every month."

Execution Times: 1st and 15th of each month at 12:00 AM

Plain English: Runs twice monthly, mid-month and month-start.

Example 4: Run on Weekdays Only

0 9 * * 1,2,3,4,5

Translation: "At 9:00 AM on Monday, Tuesday, Wednesday, Thursday, and Friday."

Plain English: Runs every weekday at 9 AM. Skips weekends.

Example 5: Run in Specific Months

0 0 1 1,4,7,10 *

Translation: "At midnight on the 1st day of January, April, July, and October."

Plain English: Runs quarterly on the first day of each quarter.

Multiple Commas

You can list as many values as needed:

0 8,9,10,11,12,13,14,15,16,17 * * *

Translation: "At the top of every hour from 8 AM through 5 PM."

Plain English: Runs every hour during business hours (10 times daily).

(Note: This is less elegant than 0 8-17 * * * using a range—see next section.)

Common Comma Patterns

| Expression | Meaning | |------------|---------| | 0 9,12,15,18 * * * | At 9 AM, noon, 3 PM, 6 PM | | 0 0 * * 1,5 | Midnight on Monday and Friday | | 30 10 1,15 * * | 10:30 AM on 1st and 15th of month | | 0 */2 * * 1,3,5 | Every 2 hours on Mon, Wed, Fri |

Combining Commas and Slashes

Yes, you can use both operators together:

0,30 */2 * * *

Translation: "At minutes 0 and 30 of every 2nd hour."

Execution Times: 12:00 AM, 12:30 AM, 2:00 AM, 2:30 AM, 4:00 AM, 4:30 AM, etc.

Plain English: Runs twice every 2 hours (24 times daily).

The Hyphen (-): "Range" or "THROUGH"

The hyphen operator defines a range of values. It means "from X THROUGH Y" (inclusive on both ends).

Syntax

start-end

What It Means

The hyphen specifies a continuous range:

  • 1-5 means "1, 2, 3, 4, 5"
  • 9-17 means "9, 10, 11, 12, 13, 14, 15, 16, 17"
  • Both start and end values are included

Examples

Example 1: Business Hours (9 AM - 5 PM)

0 9-17 * * *

Translation: "At minute 0 of every hour from 9 through 17."

Execution Times: 9:00 AM, 10:00 AM, 11:00 AM, 12:00 PM, 1:00 PM, 2:00 PM, 3:00 PM, 4:00 PM, 5:00 PM

Plain English: Runs every hour during business hours (9 times daily).

Example 2: Weekdays Only (Monday - Friday)

0 9 * * 1-5

Translation: "At 9:00 AM on every day from Monday (1) through Friday (5)."

Plain English: Runs every weekday at 9 AM.

Example 3: First Week of the Month

0 0 1-7 * *

Translation: "At midnight on days 1 through 7 of every month."

Plain English: Runs daily during the first week of each month.

Example 4: Winter Months (Nov - Feb)

0 0 * 11-12 *
0 0 * 1-2 *

Translation: "At midnight every day in November, December, January, and February."

Note: You need two separate cron jobs because the range can't wrap across the year boundary (11-12 for Nov-Dec, 1-2 for Jan-Feb).

Example 5: Every 15 Minutes During Business Hours

*/15 9-17 * * 1-5

Translation: "Every 15 minutes from hour 9 through 17, Monday through Friday."

Execution Times: Every 15 minutes (XX:00, XX:15, XX:30, XX:45) from 9 AM to 5:59 PM, weekdays only.

Plain English: Runs every 15 minutes during the business week.

Range Boundaries Are Inclusive

Important: Both ends of a range are included in the match.

0 9-17 * * *

This runs at 9:00 AM AND 5:00 PM (and every hour in between). It does not stop at 4:00 PM.

If you want to exclude the end boundary, use a comma list:

0 9,10,11,12,13,14,15,16 * * *  # Stops at 4 PM, excludes 5 PM

Or more elegantly:

0 9-16 * * *  # 9 AM through 4 PM (excludes 5 PM)

Common Range Patterns

| Expression | Meaning | |------------|---------| | 0 9-17 * * * | Every hour, 9 AM - 5 PM | | * * * * 1-5 | Every minute, Mon - Fri | | 0 0 * * 6-7 | Midnight on weekends (Sat-Sun) | | 0 8-18/2 * * * | Every 2 hours, 8 AM - 6 PM | | 0 0 1-7 * * | Midnight, first week of month |

Ranges Don't Wrap Around

You cannot create a range that wraps around the end of the field:

This does NOT work:

0 22-2 * * *  # Intended: 10 PM through 2 AM

Cron won't execute this correctly. Instead, use two separate jobs:

Correct approach:

0 22-23 * * *  # 10 PM - 11 PM
0 0-2 * * *    # Midnight - 2 AM

Or use a comma list:

0 22,23,0,1,2 * * *  # 10 PM, 11 PM, midnight, 1 AM, 2 AM

Combining Operators: Advanced Patterns

The real power of cron comes from combining these operators. Here are common patterns:

Pattern 1: Comma + Range

Run every hour during two separate time blocks:

0 8-11,13-17 * * *

Translation: "At minute 0 of hours 8-11 and 13-17."

Execution Times: 8 AM, 9 AM, 10 AM, 11 AM, 1 PM, 2 PM, 3 PM, 4 PM, 5 PM

Use Case: Office hours with a lunch break from noon to 1 PM.

Pattern 2: Slash + Range

Every 30 minutes, but only during business hours:

*/30 9-17 * * *

Translation: "Every 30 minutes from hour 9 through 17."

Execution Times: 9:00, 9:30, 10:00, 10:30, ... 5:00, 5:30

Use Case: Regular polling during work hours only.

Pattern 3: Comma + Slash

Run twice an hour, every 3 hours:

0,30 */3 * * *

Translation: "At minutes 0 and 30 of every 3rd hour."

Execution Times: 12:00 AM, 12:30 AM, 3:00 AM, 3:30 AM, 6:00 AM, 6:30 AM, etc.

Use Case: Frequent checks at regular intervals.

Pattern 4: Range + Range

Weekday mornings only:

0 6-12 * * 1-5

Translation: "At the top of every hour from 6 AM through noon, Monday through Friday."

Execution Times: 6 AM - noon, weekdays only (7 times daily, 5 days/week = 35 times/week)

Use Case: Morning reports during the business week.

Pattern 5: All Four Operators

Every 15 minutes during business hours on weekdays, first half of the month:

*/15 9-17 1-15 * 1-5

Translation: "Every 15 minutes from 9 AM through 5:59 PM on days 1-15 of the month, Monday through Friday."

Use Case: Intensive monitoring during busy periods.

Pattern 6: Complex Lists

Run at specific times on specific days:

0 6,12,18 * * 1,3,5

Translation: "At 6 AM, noon, and 6 PM on Monday, Wednesday, and Friday."

Execution Times: 3 times daily, but only on Mon/Wed/Fri (9 times weekly)

Use Case: Regular tasks on alternate weekdays.

Operator Precedence and Interaction

When multiple operators appear in the same field, here's how they interact:

Precedence Order

  1. Hyphen (-) - Evaluated first to create ranges
  2. Comma (,) - Evaluated second to create lists (including lists of ranges)
  3. Slash (/) - Evaluated last to create steps within ranges

Example: Parsing a Complex Expression

0,15,30,45 8-17 */2 1,4,7,10 1-5

Let's break it down:

Minute: 0,15,30,45

  • Comma operator creates a list
  • Runs at minutes: 0, 15, 30, 45

Hour: 8-17

  • Hyphen creates a range
  • Runs during hours: 8, 9, 10, 11, 12, 13, 14, 15, 16, 17

Day of Month: */2

  • Slash creates step values starting at 1
  • Runs on days: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31

Month: 1,4,7,10

  • Comma creates a list
  • Runs in months: January, April, July, October

Day of Week: 1-5

  • Hyphen creates a range
  • Runs on days: Monday, Tuesday, Wednesday, Thursday, Friday

Result: This cron job runs at :00, :15, :30, and :45 past every hour from 8 AM to 5 PM on odd-numbered days during the first month of each quarter, but only on weekdays.

Frequency: 4 times/hour × 10 hours × ~8 odd weekdays/month × 4 months = ~1,280 executions/year

Special Cases and Edge Behaviors

Day of Month vs. Day of Week

When both day-of-month AND day-of-week are specified (not *), cron uses OR logic, not AND logic.

Example:

0 0 13 * 5

You might think: "Run at midnight on Friday the 13th."

What actually happens: "Run at midnight on the 13th of every month OR every Friday."

If you want "Friday the 13th only," you need a wrapper script that checks both conditions:

0 0 13 * 5 [ $(date +\%u) -eq 5 ] && [ $(date +\%d) -eq 13 ] && /your/script.sh

Zero-Based vs. One-Based Fields

Different fields use different numbering:

| Field | Range | Notes | |-------|-------|-------| | Minute | 0-59 | Zero-based | | Hour | 0-23 | Zero-based (0 = midnight) | | Day of Month | 1-31 | One-based | | Month | 1-12 | One-based (1 = January) | | Day of Week | 0-7 | Both 0 and 7 = Sunday |

Watch out for:

  • 0 0 0 * * is invalid (day-of-month can't be 0)
  • 0 0 1 0 * is invalid (month can't be 0)

Step Values with Different Starting Points

*/15 * * * *  # Starts at 0: runs at :00, :15, :30, :45
5-55/15 * * * *  # Starts at 5: runs at :05, :20, :35, :50

Both run 4 times per hour, but at different offsets.

Common Patterns: Quick Reference

Every X Minutes

| Expression | Meaning | |------------|---------| | * * * * * | Every minute | | */2 * * * * | Every 2 minutes | | */5 * * * * | Every 5 minutes | | */10 * * * * | Every 10 minutes | | */15 * * * * | Every 15 minutes | | */30 * * * * | Every 30 minutes |

Every X Hours

| Expression | Meaning | |------------|---------| | 0 * * * * | Every hour | | 0 */2 * * * | Every 2 hours | | 0 */3 * * * | Every 3 hours | | 0 */6 * * * | Every 6 hours | | 0 */12 * * * | Every 12 hours |

Specific Times

| Expression | Meaning | |------------|---------| | 0 9 * * * | 9:00 AM daily | | 30 14 * * * | 2:30 PM daily | | 0 0 * * * | Midnight daily | | 0 12 * * * | Noon daily |

Weekly Schedules

| Expression | Meaning | |------------|---------| | 0 9 * * 1 | 9 AM every Monday | | 0 9 * * 1-5 | 9 AM weekdays | | 0 9 * * 6,7 | 9 AM weekends | | 0 0 * * 0 | Midnight every Sunday |

Monthly Schedules

| Expression | Meaning | |------------|---------| | 0 0 1 * * | Midnight on 1st of month | | 0 0 15 * * | Midnight on 15th of month | | 0 0 1,15 * * | Midnight on 1st and 15th | | 0 0 L * * | Last day of month (non-standard) |

Practical Examples with Explanations

Example 1: Run Every 5 Minutes During Peak Hours

*/5 8-20 * * *

Operator breakdown:

  • */5 - Slash operator: every 5 minutes (0, 5, 10, 15, ..., 55)
  • 8-20 - Hyphen operator: hours 8 through 20 (8 AM through 8 PM)
  • * * * - Asterisks: every day, every month, every day of week

Result: Runs 12 times/hour × 13 hours = 156 times daily

Example 2: Backup Database on Weekday Mornings

0 2 * * 1-5

Operator breakdown:

  • 0 - Exact value: at minute 0
  • 2 - Exact value: at hour 2 (2 AM)
  • * - Asterisk: any day of month
  • * - Asterisk: any month
  • 1-5 - Hyphen operator: Monday through Friday

Result: Runs once per weekday at 2:00 AM

Example 3: Send Reports Three Times Daily

0 8,13,18 * * *

Operator breakdown:

  • 0 - Exact value: at minute 0
  • 8,13,18 - Comma operator: at hours 8, 13, and 18 (8 AM, 1 PM, 6 PM)
  • * * * - Asterisks: every day

Result: Runs 3 times daily at specific times

Example 4: Run Every 10 Minutes, But Only :00, :10, :20, :30

0-30/10 * * * *

Operator breakdown:

  • 0-30/10 - Combination: range 0-30, step by 10
    • Hyphen creates range: 0 through 30
    • Slash divides by steps: 0, 10, 20, 30
  • * * * * - Asterisks: every hour, every day

Result: Runs at :00, :10, :20, :30 of every hour (4 times/hour)

Example 5: Quarterly Maintenance on First Sunday

0 3 1-7 1,4,7,10 0

Operator breakdown:

  • 0 - Minute 0
  • 3 - Hour 3 (3 AM)
  • 1-7 - Hyphen: days 1 through 7 (first week)
  • 1,4,7,10 - Comma: January, April, July, October
  • 0 - Sunday

Result: Runs on the first Sunday of Jan, Apr, Jul, Oct at 3:00 AM

Note: This will run on any Sunday that falls within the first 7 days, which is the first Sunday of each quarter.

Debugging Cron Expressions

When your cron expression doesn't behave as expected:

Step 1: Break Down Each Field

Write out what each position matches:

*/10 8-17 * * 1-5
│    │    │ │ │
│    │    │ │ └─ Monday through Friday
│    │    │ └─── Any month
│    │    └───── Any day of month
│    └────────── Hours 8, 9, 10, ..., 17
└─────────────── Minutes 0, 10, 20, 30, 40, 50

Step 2: Calculate Frequency

  • Per hour: 6 times (every 10 minutes)
  • Per day: 6 × 10 hours = 60 times
  • Per week: 60 × 5 days = 300 times

Step 3: Test with Cron Expression Tools

Use online validators to see next execution times:

  • crontab.guru - Shows next runs
  • Our Cron Generator (link below) - Visual builder and validator

Step 4: Check System Logs

# View cron execution log
grep CRON /var/log/syslog

# View specific user's cron jobs
crontab -l

Common Mistakes and How to Fix Them

Mistake 1: Confusing Comma and Hyphen

Wrong:

0 9-17 * * *  # Thinking this runs at 9 AM and 5 PM only

Correct:

0 9,17 * * *  # Actually runs at 9 AM and 5 PM only

The hyphen runs EVERY hour from 9 through 17. The comma runs ONLY at 9 and 17.

Mistake 2: Expecting Ranges to Wrap

Wrong:

0 22-2 * * *  # Doesn't work as expected

Correct:

0 22-23,0-2 * * *  # Use comma to combine two ranges

Mistake 3: Forgetting Step Values Start at Zero

Wrong assumption:

*/15 * * * *  # Thinking this starts at :15

Actual behavior:

*/15 * * * *  # Actually runs at :00, :15, :30, :45

If you want :15, :30, :45, :00 (next hour), use:

15,30,45,0 * * * *

Mistake 4: Day of Month AND Day of Week

Wrong assumption:

0 0 13 * 5  # Thinking: "Friday the 13th only"

Actual behavior: "Runs on the 13th of every month OR every Friday" (not both)

Mistake 5: Using Invalid Values

Wrong:

0 0 0 * *   # Day of month can't be 0
0 0 32 * *  # Day 32 doesn't exist
0 25 * * *  # Hour 25 doesn't exist (max is 23)

Correct ranges:

  • Minutes: 0-59
  • Hours: 0-23
  • Day of Month: 1-31
  • Month: 1-12
  • Day of Week: 0-7

Summary: Operator Cheat Sheet

| Operator | Name | Meaning | Example | Result | |----------|------|---------|---------|--------| | * | Asterisk | Every/Any | * * * * * | Every minute | | / | Slash | Every X (step) | */15 * * * * | Every 15 minutes | | , | Comma | List (AND) | 0 9,17 * * * | At 9 AM and 5 PM | | - | Hyphen | Range (THROUGH) | 0 9-17 * * * | Every hour 9 AM-5 PM |

Quick Mental Model

  • * = "I don't care, match everything"
  • / = "Every X intervals"
  • , = "At these specific values"
  • - = "From this value through that value"

Combining Operators

  • Comma + Hyphen: 0 8-11,13-17 * * * = "Two separate time blocks"
  • Slash + Hyphen: */30 9-17 * * * = "Every 30 min during business hours"
  • All three: 0,30 */2 * * 1-5 = "At :00 and :30 of every 2nd hour on weekdays"

Conclusion

Cron operators transform simple schedules into powerful automation:

  • The asterisk (*) gives you flexibility: "run regardless of this field"
  • The slash (/) gives you intervals: "every X units"
  • The comma (,) gives you precision: "at exactly these values"
  • The hyphen (-) gives you ranges: "from start through end"

Master these four operators, and you can express any schedule imaginable.

Your next steps:

  1. Identify a repetitive task you need to automate
  2. Determine when it should run
  3. Use the operators to build your expression
  4. Test it with a cron validator
  5. Add it to your crontab

Ready to build and test your cron expressions? Use our Cron Expression Generator to visually create schedules and see exactly when they'll run.


Related Articles

Get Started with Cron:

Troubleshooting:

Advanced Topics:


Keywords: cron slash, cron comma, cron operators, cron syntax explained, cron every 15 minutes, cron asterisk, cron hyphen, cron expression syntax, cron step values, cron range