Monday, May 13, 2013

Add, Edit, Delete, List cronjobs in Linux

If you want to add cronjob or edit an existing one you can use the crontab command:
#crontab -e
The '-e' param stands for edit. This will open the crontab file for the current logged user. If you want to edit the crontab file for a specific user you need to specify the username:
#crontab -e -u username
  To delete user's crontab use the following command:
#crontab -r
or for a specific user:
#crontab -r -u username
To list cronjob:
#crontab -l
 or
 #crontab -l -u username

When you edit the crontab file, it will be open in your default editor. If you want to be open in a specific editor you can use the env command:
#env EDITOR=nano crontab -e
This will open the crontab file in nano editor.

No comments:

Post a Comment