Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

System crontab:


Root crontab:

sudo crontab -u root -e

Which way is preferred? As they all run tasks within administration privilege.

share|improve this question

/etc/crontab is the system wide crontab.

The format of /etc/crontab is like this:

# m h dom mon dow user      command
*   *  *   *   *  someuser  echo 'foo'

while crontab -e is per user, it's worth mentioning with no -u argument the crontab command goes to the current users crontab. You can do crontab -e -u <username> to edit a specific users crontab.

Notice in a per user crontab there is no 'user' field.

# m h  dom mon dow  command
*   *   *   *   *   echo 'foo'

An aspect of crontabs that may be confusing is that root also has its own crontab. e.g. crontab -e -u root will not edit /etc/crontab See Configuring cron.

In Linux distros, per user crontabs are typically stored in: /var/spool/crontabs/<username>



share|improve this answer
As Congiruring cron says: there is usually no need to create a user crontab for root. Is that true? I mean the standard way is to edit the /etc/crontab, am I right? – ShadowGiraffe May 3 '14 at 22:32
There is no "standard" way, thus you can have both files. I usually edit root's crontab and avoit /etc/crontab just becaused I am used to crontab -e – phoops May 3 '14 at 22:35

/etc/cron.d (and its brothers cron.daily/weekly/monthly) is preferred for all system crontabs. You shouldn't need to touch /etc/crontab.

It's essential to separate cron entries in multiple files, based on their functionality if you are planing to manage or automate things. Files under /etc/cron.d can be easily managed by packages or configuration management tools like puppet and chef. Root's crontab OTOH is practically un-maintenable by anything other than humans.

So in short, for system stuff you can use /etc/cron.*. If there's something you would like the root user to do then use root's crontab. /etc/crontab should be left untouched and managed by a package.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.