Blog › Linux · Published 2026-11-26

Linux cron job syntax: the five fields, explained

A crontab is Linux's task schedule: each line says "when" followed by "what". The syntax looks cryptic once, but it is five time fields followed by the command. This guide is built on the official crontab(5) manual page.

The five fields

FieldAllowed values
Minute0-59
Hour0-23
Day of month1-31
Month1-12
Day of week0-7 (0 and 7 are Sunday)

An asterisk * means "every possible value" in that field.

Examples you can now read

# every hour at minute 30
30 * * * * /home/sam/backup.sh

# daily at 2:15 AM
15 2 * * * /home/sam/cleanup.sh

# every Monday at 9:00 AM
0 9 * * 1 /home/sam/report.sh

Read left to right: minute, hour, day of month, month, day of week.

The day-of-month / day-of-week rule

A subtle point from the manual: the command runs when the minute, hour and month fields all match, and at least one of the two day fields (day of month or day of week) matches. Writing both day fields together can mean "or", not "and", so be careful when combining them.

Edit and inspect

crontab -e   # edit your schedule
crontab -l   # list it

cron checks the tables every minute, so nothing needs a restart after saving.

Common mistakes

Related: log into your server with SSH keys and the Arabic version of this guide.

Official sources

Need help with your project?
We build websites, systems and automation. Start your project WhatsApp

All articles