crontab(1)
Install, list, edit, or remove cron jobs for the current user.
Synopsis
crontab [-u user] [-l | -e | -r | -i]Description
Crontab installs a table of cron jobs to be run by the cron daemon at specified times. Each user has their own crontab file, stored in /var/spool/cron/crontabs/. The crontab file contains six fields per line: minute, hour, day of month, month, day of week, and command to execute.
Fields are space-separated integers or special characters (* for any, - for range, , for list, / for step). Use -e to edit, -l to list, -r to remove, and -i to prompt before removal.
Common options
| Flag | What it does |
|---|---|
-e | Edit the current user's crontab using the editor specified by VISUAL or EDITOR |
-l | List the current user's crontab entries |
-r | Remove the current user's crontab file |
-i | Prompt the user for confirmation before removing the crontab (used with -r) |
-u user | Operate on the specified user's crontab (requires root privileges) |
-s | Append the current SELinux security context to crontab entries |
Examples
Open the current user's crontab in the default editor for editing
crontab -eDisplay all scheduled cron jobs for the current user
crontab -lExample crontab line: run backup.sh every day at 2:00 AM
0 2 * * * /usr/local/bin/backup.shExample crontab line: run check_status.sh every 15 minutes
*/15 * * * * /usr/bin/check_status.shList the crontab for user 'alice' (requires root)
crontab -u alice -lRemove the current user's entire crontab file
crontab -rRemove crontab with a confirmation prompt
crontab -i -rExample crontab line: run script monthly on the 1st at midnight, logging output
0 0 1 * * /opt/script.sh > /var/log/script.log 2>&1