Utility

Cron Syntax Demystified: Scheduling Jobs Like a Pro

Cron is the universal scheduling language for Unix systems. Learn how to read and write cron expressions, the edge cases that trip people up, and modern alternatives.

Published August 5, 2026

Try it yourself

Cron Parser — free, instant, client-side

Open Cron Parser

What Is Cron?

Cron is a time-based job scheduler built into Unix-like operating systems. It runs commands or scripts at specified intervals according to a schedule defined in a crontab (cron table). The name comes from Kronos, the Greek god of time.

The cron daemon reads crontab files and executes the scheduled commands at the right times. Almost every Linux server runs cron for tasks like log rotation, database backups, and cache invalidation.

The Five-Field Expression

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–7, where 0 and 7 are Sunday)
│ │ │ │ │
* * * * * command

Each field can contain:

  • A specific value: 5 (exactly at minute 5)
  • A wildcard: * (every minute/hour/day)
  • A range: 1-5 (Monday through Friday)
  • A list: 1,3,5 (Monday, Wednesday, Friday)
  • A step: */15 (every 15 minutes), 0-12/2 (every even hour from 0 to 12)

Common Examples

# Every minute
* * * * *

# Every hour at minute 0
0 * * * *

# Every day at midnight
0 0 * * *

# Every Sunday at 3am
0 3 * * 0

# Every 15 minutes
*/15 * * * *

# Weekdays at 9am
0 9 * * 1-5

# First day of every month at noon
0 12 1 * *

# Every 6 hours
0 */6 * * *

Special Strings

Many cron implementations support shorthand strings:

String Equivalent
@yearly 0 0 1 1 *
@monthly 0 0 1 * *
@weekly 0 0 * * 0
@daily 0 0 * * *
@hourly 0 * * * *
@reboot Run once at startup

Six-Field Expressions

Many modern schedulers (AWS EventBridge, Spring, Quartz) add a seconds field at the beginning:

* * * * * *
│ │ │ │ │ │
│ │ │ │ │ └── day of week
│ │ │ │ └──── month
│ │ │ └────── day of month
│ │ └──────── hour
│ └────────── minute
└──────────── second

This is a source of common confusion — whether your scheduler expects 5 or 6 fields matters.

Common Pitfalls

Day of month + day of week. When both fields are non-wildcards, most cron implementations run the job when either condition is true, not both. Use * in one field to avoid ambiguity.

Timezone. Cron runs in the server's local timezone unless configured otherwise. If your server and your users are in different timezones, calculate accordingly.

Environment. The cron environment is minimal — your PATH, HOME, and other variables may not be set. Use absolute paths in cron commands.

Missed jobs. Standard cron does not "catch up" on jobs missed while the system was down. Use tools like cronie with anacron if you need this behaviour.

Try It

The Cron Parser on Syntaxly takes any cron expression and shows you exactly when the next several runs will occur, in plain English.

Try it yourself

Cron Parser — free, instant, client-side

Open Cron Parser

More Utility guides

Utility

Regular Expressions: Patterns, Pitfalls, and Best Practices

Regex is powerful and cryptic. Learn the core syntax, the most useful patterns for everyday development, and the common mistakes that cause bugs in production.

Utility

Unix Timestamps: Epoch Time and Time Zone Handling

Unix timestamps are the universal language of time in computing. Learn what epoch time is, how to convert it, and the timezone pitfalls every developer hits eventually.

Utility

Text Metrics: Word Count, Readability, and Why They Matter

Counting words and characters is deceptively nuanced. Learn how word boundaries are defined, what readability scores measure, and when text metrics actually matter for your content.

© 2026. Syntaxly | Built for the minimalist developer.