What is crontab syntax?

QuestionsQuestions8 SkillsProYour First Linux LabNov, 11 2025
0137

The crontab syntax consists of five fields followed by the command to be executed. The fields represent time and date when the command should run. The syntax is as follows:

* * * * * command_to_execute

Each asterisk can be replaced with specific values:

  1. Minute (0-59)
  2. Hour (0-23)
  3. Day of the Month (1-31)
  4. Month (1-12)
  5. Day of the Week (0-7) (Sunday is both 0 and 7)

You can use the following symbols in the fields:

  • * - Every value (e.g., every minute, every hour)
  • , - List of values (e.g., 1,2,3 for the 1st, 2nd, and 3rd)
  • - - Range of values (e.g., 1-5 for Monday to Friday)
  • / - Step values (e.g., */5 for every 5 minutes)

For example, the cron schedule 0 9 * * 1-5 means "run the command at 9 AM on weekdays (Monday to Friday)."

0 Comments

no data
Be the first to share your comment!