I login to my UNIX system as a normal user. However, I need to update my cronjob entry. But, I can’t find where the crontab file is. How do I find out my crontab file location?
By default cron searches its spool area /var/spool/cron/ directory for crontab files. All files which are named after username i.e. accounts in /etc/passwd file. So if your username is [donotprint][/donotprint]vivek, crontab file location should be /var/spool/cron/$USER i.e. /var/spool/cron/vivek. Note that cron in this directory should not be accessed directly – the crontab command should be used to access and update them as follows:
To view your crontab file (cron jobs) type:
Directory for personal crontab files
Linux and Unix-like operating system may change the default from /var/spool/cron/ to something else. Use the following as a guideline for your OS (assuming that user name is vivek):
- Mac OS X – /usr/lib/cron/tabs/ (user cron location /usr/lib/cron/tabs/vivek)
- FreeBSD/OpenBSD/NetBSD – /var/cron/tabs/ (user cron location /var/cron/tabs/vivek)
- CentOS/Red Hat/RHEL/Fedora/Scientific Linux – /var/spool/cron/ (user cron location /var/spool/cron/vivek)
- Debian / Ubuntu Linux – /var/spool/cron/crontabs/ (user cron location /var/spool/cron/crontabs/vivek)
- HP-UX Unix – /var/spool/cron/crontabs/ (user cron location /var/spool/cron/crontabs/vivek)
- IBM AIX Unix – /var/spool/cron/ (user cron location /var/spool/cron/vivek)
I suggest that you read local cron man page to get exact location for directory for personal crontab or use the above two commands.