What is the difference between crontab -e and nano /etc/crontab? [duplicate]
Solution 1:
The crontab -e
command will edit the crontab for your current user. This means that you do not need to include the username in the crontab line. Each user's crontab is stored in /var/spool/cron/crontabs
, under the user's name.
The format of a user specific crontab is:
# m h dom mon dow command
* * * * * some_command
The crontab -e
command will use whichever editor is set in your user's $EDITOR environment variable, which controls your default text editor for a variety of tasks. If that isn't set the first time you use the crontab
command you'll be prompted to choose from a selection of available editors, nano
is one of the choices on this list.
Editing /etc/crontab
requires that you include a username that's running the command after the time setting part of the line.
The format of /etc/crontab is:
# m h dom mon dow user command
* * * * * someuser some_command