System Administration Guide

How to Remove a crontab File

  1. (Optional) To remove a crontab file belonging to root or another user, become superuser.

  2. Remove the crontab file.


    $ crontab -r [username]

    username

    Name of another user's account, and requires superuser privilegs to create or edit. 


    Caution - Caution -

    If you accidentally enter the crontab command with no option, press the interrupt character for your editor. This allows you to quit without saving changes. Exiting the file and saving changes at this point would overwrite an existing crontab file with an empty file.


  3. Verify the crontab file is removed.


    # ls /usr/spool/cron/crontabs
    

Example--Removing a crontab File

The following example shows how to use crontab -r to remove the default user's crontab file, as well as crontab files belonging to root and another user. ls verifies that the correct crontab files have been removed.


$ ls /usr/spool/cron/crontabs
adm     jones     lp     root    smith    sys
$ crontab -r
$ ls /usr/spool/cron/crontabs
adm     jones     lp     root    sys
$ su
Password:
# crontab -r
# ls /usr/spool/cron/crontabs
adm     jones     lp    sys
# crontab -r jones
# ls /usr/spool/cron/crontabs
adm     lp    sys