logo
🐧 Linux 命令

Cron

Cron Cheat Sheet - 快速参考指南,收录常用语法、命令与实践。

📂 分类 · Linux 命令🧭 Markdown 速查🏷️ 2 个标签
#cron#schedule
向下滚动查看内容
返回全部 Cheat Sheets

Crontab Format

Format
CODE
滚动查看更多
Min  Hour Day  Mon  Weekday

CODE
滚动查看更多
*    *    *    *    *  command to be executed
CODE
滚动查看更多
┬    ┬    ┬    ┬    ┬
│    │    │    │    └─  Day of Week   (0=Sun .. 6=Sat)
│    │    │    └──────  Month         (1..12)
│    │    └───────────  Day of Month  (1..31)
│    └────────────────  Hour          (0..23)
└─────────────────────  Minute        (0..59)

FieldRangeSpecial characters
Minute0 - 59, - * /
Hour0 - 23, - * /
Day of Month1 - 31, - * ? / L W
Month1 - 12, - * /
Day of Week0 - 6, - * ? / L #

{.show-header}

Examples
ExampleDescription
*/15 * * * *Every 15 mins
0 * * * *Every hour
0 */2 * * *Every 2 hours
15 2 * * *At 2:15AM (of every day)
15 2 * * ?At 2:15AM (of every day)
10 9 * * 5At 9:10AM (of every Friday)
0 0 * * 0At 12:00 AM, only on Sunday
15 2 * * 1LAt 2:15am on the last monday of every month
15 0 * * 4#2At 00:15am on the second thursday of every month
0 0 1 * *At 12:00 AM, on day 1 of the month (1st of month / monthly)
0 0 1 1 *At 12:00 AM, on day 1 of the month, only in January (1st of month)
@rebootEvery reboot <br>(non-standard)
Cron Generator
<widget name="cron"/>
Special strings
Special StringMeaning
@rebootRun once, at system startup (non-standard)
@yearlyRun once every year, "0 0 1 1 *" (non-standard)
@annually(same as @yearly) (non-standard)
@monthlyRun once every month, "0 0 1 * *" (non-standard)
@weeklyRun once every week, "0 0 * * 0" (non-standard)
@dailyRun once each day, "0 0 * * *" (non-standard)
@midnight(same as @daily) (non-standard)
@hourlyRun once an hour, "0 * * * *" (non-standard)
Crontab command
--
crontab -eEdit or create a crontab file if doesn’t already exist.
crontab -lDisplay the crontab file.
crontab -rRemove the crontab file.
crontab -vDisplay the last time you edited your crontab file.<br>(non-standard)

{.shortcuts}

Special characters
Special CharacterDescription
Asterik(*)Matches all values in the field or any possible value.
Hyphen(-)Used to define a range.Ex: 1-5 in 5th field(Day Of Week) Every Weekday i.e., Monday to Friday
Slash (/)1st field(Minute) /15 meaning every fifteen minute or increment of range.
Comma (,)Used to separate items.Ex: 2,6,8 in 2nd fields(Hour) executes at 2am,6am and 8am
LIt is allowed only for Day of Month or Day Of Week field, 2L in Day of week indicates Last tuesday of every month
Hash (#)It is allowed only for Day Of Week field, which must be followed within range of 1 to 5. For example, 4#1 means "The first Thursday" of given month.
Question mark (?)Can be instead of '*' and allowed for Day of Month and Day Of Week. Usage is restricted to either Day of Month or Day Of Week in a cron expression.

Also see

相关 Cheat Sheets

1v1免费职业咨询
logo

Follow Us

linkedinfacebooktwitterinstagramweiboyoutubebilibilitiktokxigua

We Accept

/image/layout/pay-paypal.png/image/layout/pay-visa.png/image/layout/pay-master-card.png/image/layout/pay-airwallex.png/image/layout/pay-alipay.png

地址

Level 10b, 144 Edward Street, Brisbane CBD(Headquarter)
Level 2, 171 La Trobe St, Melbourne VIC 3000
四川省成都市武侯区桂溪街道天府大道中段500号D5东方希望天祥广场B座45A13号
Business Hub, 155 Waymouth St, Adelaide SA 5000

Disclaimer

footer-disclaimerfooter-disclaimer

JR Academy acknowledges Traditional Owners of Country throughout Australia and recognises the continuing connection to lands, waters and communities. We pay our respect to Aboriginal and Torres Strait Islander cultures; and to Elders past and present. Aboriginal and Torres Strait Islander peoples should be aware that this website may contain images or names of people who have since passed away.

匠人学院网站上的所有内容,包括课程材料、徽标和匠人学院网站上提供的信息,均受澳大利亚政府知识产权法的保护。严禁未经授权使用、销售、分发、复制或修改。违规行为可能会导致法律诉讼。通过访问我们的网站,您同意尊重我们的知识产权。 JR Academy Pty Ltd 保留所有权利,包括专利、商标和版权。任何侵权行为都将受到法律追究。查看用户协议

© 2017-2025 JR Academy Pty Ltd. All rights reserved.

ABN 26621887572