← 返回命令列表

Linux command

crontab 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Edit

crontab -e

List

crontab -l

Remove

crontab -r

Edit

sudo crontab -e -u [username]

说明

crontab manages scheduled tasks for users. It provides an interface to edit, list, and remove the cron table, which contains commands to be executed at specified times and dates. The cron daemon reads these tables and executes jobs at their scheduled times. Each user can have their own crontab file, allowing for user-level task scheduling without requiring root privileges. The crontab command provides a safe way to edit these files, performing syntax validation and notifying the cron daemon of changes. Jobs can be scheduled to run at specific times, regular intervals, or special events like system startup.

参数

-e
Edit crontab
-l
List crontab
-r
Remove crontab
-u _user_
Specify user
-i
Interactive mode (prompt before removing)

FAQ

What is the crontab command used for?

crontab manages scheduled tasks for users. It provides an interface to edit, list, and remove the cron table, which contains commands to be executed at specified times and dates. The cron daemon reads these tables and executes jobs at their scheduled times. Each user can have their own crontab file, allowing for user-level task scheduling without requiring root privileges. The crontab command provides a safe way to edit these files, performing syntax validation and notifying the cron daemon of changes. Jobs can be scheduled to run at specific times, regular intervals, or special events like system startup.

How do I run a basic crontab example?

Run `crontab -e` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -e do in crontab?

Edit crontab