Skip to main content

Command referencecrontab

crontab command (Linux / bash / sh / zsh)

Linuxbashshzshsystemintermediate

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 / optionMeaning
-eEdit the current user's crontab.
-lList current entries.
-rRemove the current crontab.
-u USEROperate 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.

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.