DevOps & Automation

Understanding Cron Syntax: Standard 5-Field vs 6-Field Expressions

Cron jobs are the backbone of automated task scheduling in Linux, Kubernetes, AWS EventBridge, and backend services. Yet, crontab syntax remains one of the most frequently misconfigured patterns in software engineering.

The Standard UNIX 5-Field Cron Format

Standard Linux cron daemon expressions contain exactly five fields separated by whitespace:

┌───────────── minute (0 - 59) │ ┌───────────── hour (0 - 23) │ │ ┌───────────── day of the month (1 - 31) │ │ │ ┌───────────── month (1 - 12) │ │ │ │ ┌───────────── day of the week (0 - 6) (Sunday to Saturday) │ │ │ │ │ * * * * *

The Extended 6-Field Format (Seconds or Years)

Modern frameworks like Spring, Quartz, and NestJS often support or require a 6-field expression. Usually, the first field represents seconds:

┌───────────── second (0 - 59) │ ┌───────────── minute (0 - 59) │ │ ┌───────────── hour (0 - 23) │ │ │ ┌───────────── day of month (1 - 31) │ │ │ │ ┌───────────── month (1 - 12) │ │ │ │ │ ┌───────────── day of week (0 - 7) │ │ │ │ │ │ * * * * * *

Special Characters Demystified

⏱️ Parse Your Cron Expression Now