"crontab" Command

Learn all about crontab command

HOME

crontab utility is an effective way to schedule a routine background job at a specific date-time and/or day. There are 6 fields in the crontab:

<MINUTE> <HOUR> <DAYOFMONTH> <MONTHOFYEAR> <DAYOFWEEK> <COMMANDTOEXECUTE>

MINUTE           - 0 to 59
HOUR             - 0 to 23
DAYOFMONTH       - 1 to 31
MONTHOFYEAR      - 1 to 12
DAYOFWEEK        - 0 to 6
COMMANDTOEXECUTE - Command to be executed
          
here, <,> signs are shown for representation purpose only.
1. To add or update job in crontab, use following command in terminal.It will open crontab file in editor where job can be added/updated.
root:~# crontab -e
          

2. By default, crontab will edit entries of current logged in user. To edit, other user crontab execute following command:
root:~# crontab -u USERNAME -e
          

3. To display the current user's crontab entries on standard terminal.
root:~# crontab -l
          

To view, crontab entries of other user, use following command.
root:~# crontab -u USERNAME -l
          

4. To remove the current crontab.
root:~# crontab -r

This will remove all crontab entry without confirmation.
          
root:~# crontab -i -r

This will take confirmation from user before removing crontab entries.
          

5. More information can be found by following command.
root:~# man crontab