(Optional) To remove a crontab file belonging to root or another user, become superuser.
Remove the crontab file.
$ crontab -r [username] |
username |
Name of another user's account, and requires superuser privilegs to create or edit. |
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.
Verify the crontab file is removed.
# ls /usr/spool/cron/crontabs |
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 |