Crontab
Usage
A crontab is a file that holds the instructions for the cron daemon.
Each cronjob within the crontab will run a specific command at a specific time based on the crontab configuration.
- Commands:
crontab <filename>
: command to run cron-jobs within a separate file as an argumentcrontab -e
: edit current user’s crontabcrontab -l
: list current user’s crontabcrontab -r
: delete user’s crontabcrontab -i
: prompt before deleting user’s crontab
Open crontab
View the crontab file with the follwing command:
crontab -e
Output:
The default user crontab seen from the previous command will look similar to the above screenshot.
Bonus
The global crontab config file can be viewed with the following command:
sudo vim /etc/crontab
In addition to the five time parameters, and command to execute, the global crontab config file requires the user that will execute the command
* * * * * user-name command-to-run
The file was opened with vim
and can be closed with :q
.