LinuxMoz

Linux Stuff && Coffee

Edit Crontab Tutorial

| Comments

This guide walks you through the process of editing the crontab file, the default way to edit crontab on most Linux systems is Vi, love it or hate it Vi is a part of Linux head over to our Vi Commands section if you need any help.

How to edit a cron job on Linux systems

To edit the crontab or add cron jobs is done via the crontab command below are the three basic crontab commands you need to know:

Edit crontab command

Allows the user to edit their own crontab file, once open you can edit, delete or add cron jobs. On Ubuntu the first time you run this command it prompts you to chose a text editor – on other Linux systems it normally uses Vi.

1
crontab -e

Edit another users crontab

Allows the root user to edit crontab for another user.

1
crontab -e bob

How to list cron jobs

The -l option is used to list cron jobs, is will show all jobs for the current logged in user – again if you are root you can postfix this with a username to show cron jobs for that user

1
crontab -l

How to delete a cron job

This wipes the crontab file (be careful when editing crontab files as the r key is next to the l key on the keyboard!), if you wish to delete / erase a users crontab you can do so with the -u option.

1
crontab -r

Head over to our crontab syntax tutorial if you require any additional help or crontab examples.

Comments