If you have ever needed to run a task automatically every few minutes, every day, or every Monday morning, you have probably come across cron expressions.
Cron is widely used for scheduling recurring tasks on Linux servers, backend systems, CI/CD jobs, and automation workflows.
A cron expression may look confusing at first:
*/5 * * * *
But once you understand the five fields, it becomes much easier.
What Is a Cron Expression?
A standard Unix cron expression normally contains five fields:
* * * * *
│ │ │ │ │
│ │ │ │ └── Day of week
│ │ │ └──── Month
│ │ └────── Day of month
│ └──────── Hour
└────────── Minute
Each field controls when the command should run.
For example:
0 9 * * *
means:
Run every day at 9:00 AM.
Understanding the Five Fields
The standard structure is:
minute hour day-of-month month day-of-week
For example:
30 14 * * *
means:
Minute: 30
Hour: 14
Day of month: every day
Month: every month
Day of week: every day
So the job runs every day at:
14:30
or:
2:30 PM
The Asterisk *
The * means:
every possible value
For example:
* * * * *
means:
Run every minute.
This is usually not something you want in production unless the task is designed to run that frequently.
Run Every 5 Minutes
*/5 * * * *
The */5 means:
every 5 minutes
So the job runs at:
00
05
10
15
20
25
...
minutes past every hour.
Run Every Hour
0 * * * *
This means:
Run at minute 0 of every hour.
Examples:
10:00
11:00
12:00
13:00
Run Every Day at Midnight
0 0 * * *
This runs every day at:
00:00
A common use case is a nightly cleanup or backup task.
Run Every Day at 9 AM
0 9 * * *
This means:
Minute: 0
Hour: 9
So it runs every day at:
09:00
Run Every Monday at 9 AM
0 9 * * 1
In many cron implementations:
0 = Sunday
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday
So:
0 9 * * 1
means:
Run every Monday at 9:00 AM.
Run on the First Day of Every Month
0 0 1 * *
This means:
Run at midnight on the first day of every month.
This can be useful for:
- monthly reports
- billing jobs
- cleanup tasks
- data archival
Run Every 15 Minutes During Working Hours
You can combine values:
*/15 9-17 * * 1-5
This means:
Every 15 minutes
Between 9 AM and 5 PM
Monday through Friday
This is a good example of how cron expressions can become powerful while still staying compact.
Common Cron Symbols
A few symbols appear frequently:
* every value
, multiple values
- range
/ step value
Examples:
1,3,5
means:
1, 3, and 5
Example:
1-5
means:
1 through 5
Example:
*/10
means:
every 10 units
Common Cron Examples
*/5 * * * *
Every 5 minutes.
0 * * * *
Every hour.
0 0 * * *
Every day at midnight.
0 9 * * 1-5
Every weekday at 9 AM.
0 0 1 * *
First day of every month.
30 18 * * 5
Every Friday at 6:30 PM.
A Common Mistake: Cron Timezones
Cron expressions themselves normally describe a schedule, but the actual execution timezone depends on the system running the cron job.
For example:
0 9 * * *
means 9 AM according to the timezone configured on the server or scheduler.
This can cause unexpected behavior when:
- your server is using UTC
- your users are in another timezone
- daylight saving time changes
- your cloud platform uses a different timezone
Always check the timezone used by your scheduler.
Cron Syntax Can Vary
Not every cron implementation behaves exactly the same.
Traditional Unix cron commonly uses five fields:
* * * * *
But some systems add an extra field for seconds:
* * * * * *
Other platforms may have different rules for day-of-week values or special syntax.
So always check the documentation for the platform you are using.
A Tool I Built for Testing Cron Expressions
While working with cron expressions, I wanted a quick way to understand a schedule and preview upcoming run times.
So I built a Cron Expression Tester as part of my project, YBS — Your Browser Suite.
👉 Try the Cron Expression Tester
It helps you:
- test cron expressions
- understand each field
- preview upcoming run times
- catch scheduling mistakes quickly
I also built a Cron Expression Generator for creating cron expressions using simple controls:
👉 Try the Cron Expression Generator
Final Thoughts
Cron expressions can look cryptic at first, but most schedules come down to understanding these five fields:
minute hour day-of-month month day-of-week
Once you get comfortable with *, ranges, lists, and step values, cron becomes a very useful tool for automation.
What cron schedule do you use most often?
Share your examples in the comments. 👇
Top comments (0)