crontab Schedule commands to run automatically
Edits the table of scheduled jobs that the cron daemon runs for your user. Each line gives a time pattern and a command. You reach for it to run backups, clean-ups or reports on a repeating schedule.
Synopsis
crontab -l
crontab -e
crontab FILE
crontab -r
Common options
| Option or form | What it does |
|---|---|
-l | List your current crontab on standard output |
-e | Edit your crontab in the editor named by VISUAL or EDITOR. The new table is installed when you save and quit |
-r | Remove your whole crontab. It does not ask for confirmation |
-u USER | Work on another user's crontab. Needs root, and is also advised inside su |
FILE | Replace your crontab with the contents of FILE. Use - to read from standard input |
Examples
crontab -l
crontab -e
30 2 * * * /home/ana/bin/backup.sh
*/15 * * * * /home/ana/bin/check.sh >> /home/ana/check.log 2>&1
0 9 * * 1-5 /home/ana/bin/report.sh
crontab -l > crontab.backup
Notes
- A job line has five time fields, then the command: minute (0-59), hour (0-23), day of month (1-31), month (1-12), day of week (0-7, where 0 and 7 are Sunday). A * means every value, */15 means every 15th, 1-5 is a range and 1,15 is a list.
- crontab -r deletes your entire crontab at once, with no prompt and no undo. It sits next to -e on the keyboard, so a typo is easy. Run crontab -l > crontab.backup first.
- Cron runs jobs with a very small environment and a short PATH, in your home directory. Use full paths for commands and files, and send output to a log file or you will not see errors.
- Cron mails any output to you by default, which on a personal Mac often goes nowhere visible. Redirect with >> file 2>&1 to keep it.
- On macOS, cron still works but Apple recommends launchd for scheduling. Cron may also need Full Disk Access before it can touch protected folders.
See also
Last reviewed 2026-10-07.