There is a joke in the DevOps world: “I don’t memorize Cron syntax; I just Google it every time.” While funny, it points to a real issue. The standard cron job schedule format (five asterisks separated by spaces) is non-intuitive. If you get one asterisk wrong, your database backup might run every minute instead of every day, crashing your production server. The most common requirement we see is scheduling a task to run frequently—specifically, setting a cron job every 5 minutes to poll an API or flush a cache. While you can calculate the step values manually, I recommend verifying your syntax with our Online Cron Job Generator to ensure your daemon interprets the schedule exactly as you intend.
The Anatomy of Crontab: Understanding the 5 Stars
To master the “Every 5 Minutes” command, you first need to understand what the daemon is reading. When you edit your crontab (crontab -e), the system looks for lines with five specific fields followed by a command.
# ┌───────────── minute (0 – 59)
# │ ┌───────────── hour (0 – 23)
# │ │ ┌───────────── day of the month (1 – 31)
# │ │ │ ┌───────────── month (1 – 12)
# │ │ │ │ ┌───────────── day of the week (0 – 6)
# │ │ │ │ │
# * * * * * /path/to/command
The “Minute” field (the first asterisk) is where our logic lives. The default * means “Every Minute.” To change this frequency, we use Step Values (division).

How to Run a Cron Job Every 5 Minutes
There are two ways to write this. One is clean (the DevOps way), and one is messy (the rookie way).
Method 1: The Step Operator (Recommended)
The slash / operator tells Cron to “step” through the values.
*/5 * * * * /usr/bin/php /var/www/script.php
What this means: “In the minute field, starting from 0, run every 5th unit.”
Execution Times: :00, :05, :10, :15, … :55.
Method 2: The Explicit List (Not Recommended)
Technically, you can list every single minute manually using commas.
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /path/to/script
While valid, this is prone to typos. If you miss a comma, the job will fail. Stick to the */5 syntax.
Other Essential Schedules (Hours & Reboots)
Once you master the step operator, you can apply it to other fields. Here are the most searched patterns for system administration.
1. Cron Job Every Hour
If you want a script to run exactly at the top of the hour (e.g., 1:00, 2:00, 3:00), you set the minute to 0.
0 * * * * /path/to/hourly-backup.sh
Warning: Do not use * * * * * for hourly jobs. That runs “Every Minute of Every Hour.” You must lock the minute to 0.
2. Linux Cron Job Reboot (`@reboot`)
Sometimes, you don’t want a job to run at a specific time; you want it to run once when the server starts up (e.g., to start a Node.js server or mount a drive). Standard asterisks cannot do this.
Instead, we use the special @reboot macro.
@reboot /root/startup_script.sh
Pro Tip: The @reboot command runs as soon as the Cron daemon starts. This might happen before your networking stack or database is fully ready. If your script relies on MySQL, it might fail. A common fix is to add a sleep delay:@reboot sleep 60 && /root/startup_script.sh
Why Your Cron Job Isn’t Running (The “Silent Failure”)
You typed */5 * * * *, saved the file, and waited 5 minutes. Nothing happened. This is the classic DevOps headache. Cron fails silently—it doesn’t pop up an error window.
1. The “Absolute Path” Trap
When you run a command in your terminal, your shell (Bash/Zsh) knows where to look because of your $PATH variable. The Cron daemon runs in a stripped-down environment with no knowledge of your path.
- Wrong:
*/5 * * * * python script.py(Cron asks: “Where is python?”) - Right:
*/5 * * * * /usr/bin/python3 /home/user/script.py
2. Permissions and Users
Did you edit the root crontab (sudo crontab -e) or your user crontab (crontab -e)?
If your script tries to write a log file to /var/log/, a standard user cron job will fail due to “Permission Denied.” Always verify the script is executable (chmod +x script.sh).
3. Output Logging
Since Cron has no visual output, you should redirect Standard Output (stdout) and Errors (stderr) to a file to debug them.
*/5 * * * * /path/to/script.sh >> /var/log/myjob.log 2>&1
The 2>&1 ensures that even error messages get written to your log file.
Frequently Asked Questions
What is the difference between `*/5` and `5`?
This is a critical distinction. */5 means “Every 5 minutes” (0, 5, 10…). However, just putting 5 (without the slash) means “Run ONLY at 5 minutes past the hour” (e.g., 1:05, 2:05). One runs 12 times an hour; the other runs once an hour.
Does Cron run if the computer is asleep?
No. Cron relies on the system daemon being active. If you shut down your laptop or the server goes to sleep, missed jobs are not queued. They are simply skipped. For tasks that must run after a shutdown, you should look into Anacron.
Can I schedule seconds in Cron?
Standard Linux Cron has a minimum resolution of 1 minute. It cannot run “every 30 seconds.” To achieve this, you must write a shell script with a loop and a sleep command, or use a process manager like Systemd timers.
How do I list all active cron jobs?
Type crontab -l in your terminal. If you are checking for root jobs, use sudo crontab -l. This will print the active schedule to your screen.
Don’t Risk a Syntax Error
Generate the perfect Cron schedule string in one click.Open Cron Generator →
