Skip to content

crontab command

Schedule commands to run automatically with cron.

On this page

Syntax

crontab [-u user] -e | -l | -rm h dom mon dow command

Provided by the cron / cronie package. Run man crontab for the full manual.

Common options

OptionWhat it does
-eEdit your crontab
-lList your crontab
-rRemove your crontab
-u USERWork on another user's crontab
* * * * *minute hour day-of-month month day-of-week
*/NEvery N units
@rebootRun once at startup
@daily / @hourly / @weeklyShortcuts

Examples

  1. Edit your cron jobs

    crontab -e
  2. List your cron jobs

    crontab -l
  3. Edit another user's cron jobs

    sudo crontab -u www-data -e
  4. Every 5 minutes

    */5 * * * * /usr/local/bin/check.sh
  5. Every day at 2:00 AM

    0 2 * * * /usr/local/bin/backup.sh
  6. Every Sunday at midnight

    0 0 * * 0 /usr/local/bin/weekly.sh
  7. Weekdays at 9:30

    30 9 * * 1-5 /usr/local/bin/report.sh
  8. At startup

    @reboot /usr/local/bin/start-app.sh
  9. Log the output

    0 * * * * /usr/local/bin/job.sh >> /var/log/job.log 2>&1
  10. Back up your crontab

    crontab -l > crontab.bak

Tips

  • Cron runs with a minimal PATH: use full paths to commands.
  • Escape % as \% inside crontab lines.

crontab guides

See all 19 guides that use crontab →

← All Linux commands · Suggest a fix

Back to top