Back to articles
Cron Expression Cheat Sheet & Examples
NewsDevOps

Cron Expression Cheat Sheet & Examples

via Dev.to楊東霖

Cron expressions are the backbone of scheduled tasks in Unix, Linux, macOS, CI/CD pipelines, cloud functions, and container orchestration. They look cryptic at first — 0 */6 * * 1-5 — but once you understand the five (or six) fields, you can schedule anything. This cheat sheet covers the standard 5-field cron syntax, extended 6-field syntax (with seconds), every special character, and dozens of real-world examples you can copy-paste into your crontab, GitHub Actions, or Kubernetes CronJob. Cron Syntax: The 5 Fields A standard cron expression has five fields separated by spaces: ┌───────────── minute ( 0 – 59 ) │ ┌───────────── hour ( 0 – 23 ) │ │ ┌───────────── day of month ( 1 – 31 ) │ │ │ ┌───────────── month ( 1 – 12 or JAN – DEC ) │ │ │ │ ┌───────────── day of week ( 0 – 7 or SUN – SAT , 0 and 7 = Sunday ) │ │ │ │ │ * * * * * Each field can contain a single value, a range, a list, a step, or a wildcard. The expression fires when all five fields match the current time. Special Chara

Continue reading on Dev.to

Opens in a new tab

Read Full Article
2 views

Related Articles