System Administration Guide: Advanced Administration

How to Remove a crontab File

  1. (Optional) Become superuser to remove a crontab file that belongs to root or another user.

  2. Remove the crontab file.


    $ crontab -r [username]

    Where username specifies the name of the user's account for which you want to create or edit a crontab file. To create or edit crontab files requires superuser privileges.


    Caution – Caution –

    If you accidentally type the crontab command with no option, press the interrupt character for your editor. This character allows you to quit without saving changes. If you instead saved changes and exited the file, the existing crontab file is overwritten with an empty file.


  3. Verify that the crontab file is removed.


    # ls /var/spool/cron/crontabs
    

Example—Removing a crontab File

The following example shows how user smith uses the crontab -r command to remove his crontab file.


$ ls /var/spool/cron/crontabs
adm     jones     lp     root    smith    sys     uucp
$ crontab -r
$ ls /var/spool/cron/crontabs
adm     jones     lp     root    sys    uucp