DeveloperTools
DevOps Tools

Cron Expression Guide: From Basics to Advanced

Learn how cron expressions work, understand each field, and master scheduling for automation tasks.

Cron expressions define schedules for automated tasks. Used in Linux crontab, CI/CD pipelines, and task schedulers.

Cron Format

minute hour day-of-month month day-of-week

  • Minute: 0-59
  • Hour: 0-23
  • Day of month: 1-31
  • Month: 1-12
  • Day of week: 0-7 (0 and 7 = Sunday)

Special Characters

* any value. , list. - range. / step.

Common Examples

0 * * * * — Every hour. */5 * * * * — Every 5 minutes. 0 9 * * 1-5 — 9 AM weekdays. 0 0 1 * * — Midnight, 1st of month.

Frequently Asked Questions

What does */5 mean in cron?
Every 5 units. */5 in the minute field means every 5 minutes. */2 in the hour field means every 2 hours.
How do I run a cron job every day at midnight?
Use: 0 0 * * * — minute 0, hour 0, every day, every month, every weekday.
Can I use names instead of numbers?
Yes, most cron implementations accept JAN-DEC for months and SUN-SAT for weekdays.