Run crontab (cron jobs) Every 10 Minutes

See all UNIX related articles/faq
How do I run a cron job or a shell script every 10 minutes using Linux / UNIX cron service?

Cron> is a time-based scheduling service in a Linux or Unix-like computer operating systems. Cron job are used to schedule commands to be executed periodically.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements None
Est. reading time 1 minutes
You can setup commands or scripts, which will repeatedly run at a set time. Cron is one of the most useful tool in Linux or UNIX like operating systems. The cron service (daemon) runs in the background and constantly checks the /etc/crontab file, /etc/cron.*/ directories. It also checks the /var/spool/cron/ directory.
Advertisement

First, Login to UNIX/Linux system.

Type the following command to enter cronjob:
$ crontab -e
Each cronjob has the following syntax:

# +---------------- minute (0 - 59)
# |  +------------- hour (0 - 23)
# |  |  +---------- day of month (1 - 31)
# |  |  |  +------- month (1 - 12)
# |  |  |  |  +---- day of week (0 - 6) (Sunday=0 or 7)
# |  |  |  |  |
  *  *  *  *  *  command to be executed

To get crontab to run a task every 10 minutes you could type as follow:
*/10 * * * * /path/to/command
OR
*/10 * * * * /path/to/script
Save and close the file.
Where,

  1. The asterisk (*) operator specifies all possible values for a field. For example, an asterisk in the hour time field would be equivalent to every hour or an asterisk in the month field would be equivalent to every month.
  2. The */10 is used in conjunction with ranges. For example, 0-23/2 can be used in the hours field to specify command execution every other hour. Steps are also permitted after an asterisk, so if you want to say every two hours just use */2. In this example, */10 in the minutes field to specify command execution every 10 minute.
See also
This entry is 13 of 16 in the Linux Cron Jobs Howto & Tutorial series. Keep reading the rest of the series:
  1. What is cron on a Linux or Unix-like systems?
  2. How To Add Jobs To cron Under Linux or UNIX?
  3. Verify crond Daemon And Cronjobs Are Running
  4. Start Restart and Stop The Cron or Crond Service
  5. List / Display All Cron Jobs
  6. Linux / UNIX Crontab File Location
  7. Change Crontab Email Settings ( MAILTO )
  8. Disable The Mail Alert By Crontab Command On a Linux or Unix-like Systems
  9. At What Time Cron Entries In cron.daily, cron.weekly, cron.monthly Run?
  10. Execute Cron Job After System Reboot
  11. Setup and Run PHP Script As A Cron Job
  12. Run crontab job every minute on a Linux or Unix-like system
  13. Running crontab (cron jobs) Every 10 Minutes
  14. Cron Job Script Execution on the Last Day of a Month
  15. Execute / Run crontab (cron jobs) every 1 minute
  16. Ubuntu create cron.log file

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

24 comments… add one
  • rockie Jun 27, 2008 @ 15:14

    */10 * * * * /home/test.sh > /dev/null 2>&1
    crontab: error on previous line; unexpected character found in line.
    crontab: errors detected in input, no crontab file generated.

    Guess it does not work in Solaris 8

  • budacsik Sep 21, 2008 @ 11:24

    OR

    sudo -i
    cd /etc/cron.d
    touch command
    vi command
    # in command file
    MAILTO=rootmail@foo.bar
    */10 * * * * /path/to/command

    # save command file and exit
    if you do not want to receive a letter then
    MAILTO=””

  • dakota Jul 23, 2009 @ 11:38

    yeah, budacsik. why use one command when you can use 4 :)))

  • ahah Nov 25, 2011 @ 1:58

    yes, just one line
    sudo vi /etc/cron.d/command

  • Mannoj Apr 13, 2012 @ 13:41

    what if I need to start the script at 3:00 AM exactly and consecutive executions should begin after every 10 mins.
    eg: 3:00 3:10 3:20 etc… lifetime

    But the clause is, it should start exactly at 3:00. I can play in scripts. But is there an option like this in crons?

    • alex Aug 7, 2012 @ 13:46

      */10 3,4,5 * * *
      It will be called
      WHEN ( MINUITES DIVIDED BY 10 AND DIVISION REMAINDER EQUALS 0
      AND
      ( HOUR EQUALS 3 ) OR ( HOUR EQUALS 4 ) OR ( HOUR EQUALS 5 ) )

      So it will run at 3.00, 3.10, 3.20, 3.30, 3.40, 3.50, 4.00, 4.10….. 5.50

      • Mannoj Aug 10, 2012 @ 6:31

        so can I go like this to start at 3AM and then by 10 mins invokes would this continue around the clock?
        */10 3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,1,2 * * *

        • Joan Oct 27, 2012 @ 0:29

          */10 3-24 * * *
          you can define ranges within a cron job instead of separating everything with a comma

        • yoan Oct 27, 2012 @ 0:31

          you can use range instead of separating everything with a comma
          i.e */10 3-24 * * *

          • Sajad Jan 30, 2016 @ 9:47

            I think Mannoj wanted a cron job that runs 3:00 AM for the first time and every 10 minutes from 3:00 AM and goes on. But your cron job runs only at 3 to 24 every 10 minutes that is not the answer!

  • Nik Rolls Dec 3, 2012 @ 21:01

    What this post doesn’t explain is why it works. In a crontab, the / symbol means that it will run if the current value can be divided by the following number without a remainder.

    This isn’t important for simple timers like ‘every ten minutes’, but can be very useful when using more advanced calculations.

  • jordon Jan 19, 2013 @ 4:36

    This is very helpful….thnx everyone. I got my queru answerd without any more search…u gyus rock…!!

  • Sporo Jul 15, 2013 @ 7:39

    hi, how to i create a cronjob for a folder with multiple subfolders and run them all at once?

  • prakash Nov 4, 2013 @ 8:01

    don’t trust any crontab generator

  • steve Feb 8, 2014 @ 11:26

    You see the / option posted all over the net as a shortcut for “every” but I do not believe it is applicable to all systems, for instance I do not believe this will work on AIX.

    Just sayin…

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.