Command referencecrontab
crontab command (Linux / bash / sh / zsh)
What it does
Install, inspect, and edit per-user cron schedules. When people search for the crontab command linux schedule, they usually want crontab's everyday flags, safe examples, and how it differs from related tools. Below you'll find syntax, options, and copyable examples for Bash/sh/zsh.
Install, inspect, and edit per-user cron schedules.
Syntax
crontab [OPTION] [FILE]
Common options
| Flag / option | Meaning |
|---|---|
| -e | Edit the current user's crontab. |
| -l | List current entries. |
| -r | Remove the current crontab. |
| -u USER | Operate on another user's crontab when authorized. |
Practical examples
Edit jobs
crontab -e
Opens the user schedule in an editor.
List jobs
crontab -l
Prints installed cron entries.
Daily backup
0 2 * * * /home/alice/bin/backup.sh
Runs the script every day at 02:00.
Common mistakes
- Danger: using `crontab -r` when `-e` was intended removes the whole schedule.
- Depending on an interactive shell PATH or current directory inside cron.
- Failing to redirect output, causing unexpected local mail or lost diagnostics.
Related commands
- dateDisplay or format the system date and time.
- systemctlControl and inspect services and other systemd units.
- historyDisplay or modify the current shell's command history.
- Get-ServiceRetrieve service controller objects and current service states.
- exportMark shell variables for inheritance by child processes.
- setDisplay, create, or remove CMD environment variables.
- shutdownShut down, restart, sign out, or schedule power actions.
- journalctlQuery and follow logs stored by the systemd journal.
FAQ
What does crontab do in Linux?
Install, inspect, and edit per-user cron schedules.
How do I use crontab from the terminal?
Start with `crontab [OPTION] [FILE]`, then choose only the options needed for the task.
What is a practical crontab example?
Try `crontab -e` — Opens the user schedule in an editor.
Can I use crontab in a shell script?
Yes. crontab works in Bash, sh, and Zsh, but scripts should handle quoting, errors, and command output explicitly.
Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.