Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

I have been doing some research on scheduling tasks and what not. I came across the crontab command function.

Is crontab a file that is created or is it a command?

If it is a file, then how many can one user have? Are they user-specific or system-specific (for instance, if I create a task using crontab, will the task execute if another user logs in to the system?)

If it is a command, where does it store the info for executing tasks?

share|improve this question
You should wait with accepting an answer for a day or so. Maybe others come by that have an even better answer than mine. Yes, accepting an answer is important for this website to work optimally, but most important is that you get the best answer possible. Many people won't look at a question that is marked as answered and therefore won't leave their insight. – jippie Nov 5 '12 at 21:11
ah i see what you're saying, i just thought i'd mark your answer for the purpose of others but you raise an important point. NOTED! – Craig Wayne Nov 6 '12 at 0:07
I think cron, crontab, at, and anacron are all a bit too broad to be Ubuntu-specific. Go to the Unity Dash (or similar) and look for "Scheduled Tasks" – user29020 Jul 16 '14 at 19:07

The command crontab -e will create a file, but you don't need to know about that and should never edit it by hand.

man crontab shows you the various options, most important ones being:

  • crontab -e edit
  • crontab -l list

Notice that your environment as a cron job is quite different from the one you are used to in an interactive shell. Easiest to inspect this is to set a cron job as follows:

* * * * * set > /tmp/environment.log

# | | |  \day of week    0-7 (0 or 7 is Sun, or use names)
# | |  \--month          1-12 (or names, see below)
# |  \----day of month   1-31
#  \------hour           0-23
#\--------minute         0-59

For the syntax of the crontab itself check man 5 crontab.

Then wait for a minute and remove the cronjob again, because otherwise this nonsense job will run every minute.

Then check the difference between the interactive shell (just type set) and the cronjob (just type cat /tmp/environment). Especially PATH and SHELL may surprise you.

share|improve this answer
thanks @jippie! Are they system tasks that run regardless of what user is logged in or user specific? – Craig Wayne Nov 5 '12 at 21:02
You don't need to be logged on, cronjobs will always run as configured (the * * * * * part). They will run however by default as the user who created the crontab. – jippie Nov 5 '12 at 21:04
Answering my own Question: Extract from wikipedia: "...Users can have their own individual crontab files and often there is a system wide crontab file (usually in /etc or a subdirectory of /etc) which only system administrators can edit..." – Craig Wayne Nov 5 '12 at 21:04
thanks @jippie :) – Craig Wayne Nov 5 '12 at 21:05

If you are interested in scheduling tasks as a normal user account in Ubuntu (i.e. you're not doing system-wide things as root), then you should skip all the specifics of cron, crontab, at, and anacron.

Instead, look at the Scheduled Tasks application available in Ubuntu via the Unity Dash or similar applications menu. It vastly simplifiies the work of scheduling items. There are some "gotchas" related to its use, but this way you don't have to do anything in the command line.

For example, I have a little backup script that I run periodically using Scheduled Tasks. (The program basically inserts items into your crontab, etc.)

Scheduled Tasks provides two different views. One view is simplified, like this:

enter image description here

The other view shows what the crontab would show:

enter image description here

One of the "gotchas" is that your normal "PATH" is not available for a specific scheduled item, so you need to be explicit about what command is to be run.

Anyway, the details of cron, crontab, at, and anacron are all a bit too broad to be Ubuntu-specific.

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.