Linux / UNIX Crontab File Location

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]
Tutorial details
Difficulty Easy (rss)
Root privileges No
Requirements None
Time 1m
[/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:

ADVERTISEMENTS

crontab -e

To view your crontab file (cron jobs) type:
crontab -l

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):

  1. Mac OS X/usr/lib/cron/tabs/ (user cron location /usr/lib/cron/tabs/vivek)
  2. FreeBSD/OpenBSD/NetBSD/var/cron/tabs/ (user cron location /var/cron/tabs/vivek)
  3. CentOS/Red Hat/RHEL/Fedora/Scientific Linux/var/spool/cron/ (user cron location /var/spool/cron/vivek)
  4. Debian / Ubuntu Linux/var/spool/cron/crontabs/ (user cron location /var/spool/cron/crontabs/vivek)
  5. HP-UX Unix – /var/spool/cron/crontabs/ (user cron location /var/spool/cron/crontabs/vivek)
  6. 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.

This entry is 6 of 16 in the Linux Cron Jobs Howto & Tutorial series. Keep reading the rest of the series:
  1. What is cron on a Linux or Unix-like systems?
  2. How To Add Jobs To cron Under Linux or UNIX?
  3. Verify crond Daemon And Cronjobs Are Running
  4. Start Restart and Stop The Cron or Crond Service
  5. List / Display All Cron Jobs
  6. Linux / UNIX Crontab File Location
  7. Change Crontab Email Settings ( MAILTO )
  8. Disable The Mail Alert By Crontab Command On a Linux or Unix-like Systems
  9. At What Time Cron Entries In cron.daily, cron.weekly, cron.monthly Run?
  10. Execute Cron Job After System Reboot
  11. Setup and Run PHP Script As A Cron Job
  12. Run crontab job every minute on a Linux or Unix-like system
  13. Running crontab (cron jobs) Every 10 Minutes
  14. Cron Job Script Execution on the Last Day of a Month
  15. Execute / Run crontab (cron jobs) every 1 minute
  16. Ubuntu create cron.log file
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
5 comments… add one
  • Keul Apr 15, 2011 @ 9:10

    use -u switch to see crontab of other user (must be root).
    eg :
    crontab -eu apache

  • khairul May 16, 2011 @ 4:18

    usually we use command
    crontab -e
    than after that, it will show like below:
    2 9 * * * sh /oraias/mid/cronjob/back_pll.sh
    25 12 * * * sh /autopatch/script/zipto_patch.sh
    ~
    ~
    ~
    ~
    ~
    ~
    “/var/tmp/aaaa14682” 5 lines, 143 characters

    so..as usually the file is located at /var/tmp
    and the file name is aaaa14682.

    so…try go to folder /var/tmp and then more aaaa14682

    may it will help u..

    • Doctor Who Oct 26, 2012 @ 9:10

      khairul: Are you kidding me? When you run crontab -e, it’ll create a copy of /var/spool/cron/crontabs/”user” to /var/tmp, while editing, once it’s saved, it’ll copy this file back to /var/spool/cron/crontabs/”user”…

  • chetan M Dec 2, 2013 @ 10:24

    /var/spool/cron/crontabs/”user” is right answer. its helpful when your instance is crashed and u need cron entry

  • @patrvic Aug 29, 2017 @ 9:34

    Great site but too many ads. At least do not have them in the middle of the article.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.