How to set a Cron job in Linux

Cron is an utility to automate tasks in Linux. It is the same as Windows Tasks Scheduler. You can schedule a command or a script to run at a desired time.

The syntax for setting up a cron job is as under:

Min   Hour   Day of the Month   Month   Day of the Week   Command

Min = Run at a particular minute (0-60)

Hour = Run at a particular hour (0-23)

Day of Month = Run on a particular day of the month (1-31)

Month = Run during the particular month (1-12)

Day of the Week = Run during the particular days of the week (0-6)

Command = The command or script to run


Run a job every 15th minutes

*/15   *   *   *   *   Command

Run a job on 1st of every month

*   *   1   *   * Command

Run a job every Monday at Midnight

*   0   *   *   1   Command