Yes, your crontab is (probably) stored in a file -- but there's no good reason to care about that.
On my system, that file is /var/spool/cron/crontabs/kst
, where kst
is my user name. Yours may be different depending on your system (and of course your user name).
I got this information from the crontab(1)
man page (man crontab
, in the FILES
section).
That file is not readable other than by the root
user and if you're doing something that depends on the location of that file, you're almost certainly doing something wrong. On my system, the first line of that file is:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
You should use the crontab
command to manage your crontab. It will let you indirectly edit the file, and it will manage the system so that it knows when it's been updated. If you manually modify it yourself, you'll probably just create a mess.
Use crontab -l
to see your current crontab.
You can use crontab -e
to edit your crontab (it invokes your default text editor). Personally, I avoid using crontab -e
. Instead, I maintain a copy of my crontab in a separate file, managed by a source control system, and then use crontab filename
to install it.
The /etc/crontab
file is a system crontab, which uses a different syntax; it has a 6th field on each line specifying the user account to use to execute the command. (For a personal crontab, that's not necessary, since the command will be executed by the owner of the crontab.) There are typically a number of system crontab files; if you're curious, look in the following files and directories (these may or may not exist on your system):
/etc/crontab
/etc/cron.hourly/*
/etc/cron.daily/*
/etc/cron.weekly/*
/etc/cron.monthly/*
/etc/cron.d/*