37

I have seen a crontab record in system.

0-55/5 * * * *   root  <command>

I read the crontab -e example files and I know the first position stands for minute. But I cannot figure out the meaning of / (slash) there. Could anyone explain the meaning to me?

5
  • 1
    / is a forward slash. \ is a backslash. Forward slashes lean forward. Backslashes lean backwards.
    – jw013
    Feb 18 '12 at 8:25
  • 2
    man 5 crontab has explanations too.
    – Mat
    Feb 18 '12 at 8:29
  • @jw013 thanks for correcting! @Mat Thanks. Buy the way, how to go to next page with man? I read through man crontab and through it was the end.
    – steveyang
    Feb 18 '12 at 8:35
  • 1
    @yangchenyun, it's not the next page. It's another section. man crontab brings up the first entry for crontab, which is for the crontab command in section 1. Towards the end of that manpage, it says SEE ALSO crontab(5). That tells you that you can use man 5 crontab to read the crontab entry in section 5, which describes the format of the crontab file.
    – cjm
    Feb 18 '12 at 9:17
  • @cjm Thanks for this information. I was always wondering about those (3) thing in the SEE ALSO section!
    – steveyang
    Feb 18 '12 at 13:21
37

The forward slash is used in conjunction with ranges to specify step values.

0-55/5 * * * * means your command will be executed every five minutes (0, 5, 10, 15, ..., 55).

0-55/5 is the same as */5.

5
  • 3
    By the way, a shorter way to say that is */5. Feb 21 '12 at 15:15
  • 1
    what about */31 on the minute field. Does it means the scrip will on on 0 and 31 or 1 and 31? May 25 '15 at 4:24
  • @DanielShen It would run on 0 and 31 on every hour.
    – Ville
    Apr 14 '16 at 5:41
  • why do */5 * * * * instead of 5 * * * * ? Are they not the same?
    – Andrew
    Sep 14 '17 at 20:16
  • 5
    @Andrew 5 * * * * will run at five minutes after the top of the hour, every hour (i.e., once an hour). */5 * * * * will run every five minutes (i.e., twelve times an hour)
    – thrnio
    Sep 19 '17 at 17:11

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .