What is a Crontab Command

The crontab command is used to edit or create a crontab file, list, and remove files, install and deinstall the cron jobs in Vixie Cron. The files in /var/spool/cron/crontabs are not to be edited directly, even though each user owns their crontab file.

You can use the crontab command for editing or setting up your own cron jobs.

  • crontab -e 

    “e” means “edit.” This is for the user to edit the crontab file of the present user. It can also be used to create one if nothing exists.

  • crontab -l 

    “l” means “list.” This lets you display the contents of a crontab file of the present user.

  • crontab -r

    “r” means “remove.” This is for you to remove the crontab file or the entries of the present user.

Note: This is permanent, and there may not be a prompt. Running crontab -r without a user will remove ALL the default users crons.

  • crontab -u

    “u” means “user.” If you use this alone, it will not work. A valid username has to be written after the command and should be combined with other crontab commands.

    • To show other user’s cron jobs, combine -l with -u option.
    • To edit other user’s cron jobs, combine -e with -u option.
    • To remove other user’s cron jobs, combine -r with -u option.
  • crontab -v

    This will show the last time you made changes to the crontab file. (This command is only available on a couple of systems)


Crontab File (Time Intervals)

Was this article helpful?

Related Articles