Linux /var/spool/cron/crontabs/ files and directory

See all UNIX related articles/faq
This page explains /var/spool/cron/crontabs/ or /var/cron/tabs directory and its file contains for Linux, macOS, *BSD and Unix users. All crontabs found are loaded into memory by cron service running in the background.

Tutorial details
Difficulty level Easy
Root privileges No
Requirements Linux terminal
Category Processes Management
Prerequisites Linux or Unix machine
OS compatibility *BSD Linux macOS Unix WSL
Est. reading time 3 minutes

What is /var/spool/cron/crontabs/ directory?

The cron command searches its spool area for crontab files. The /var/spool/cron/crontabs/ acts as spool area. There is a file in this directory as per accounts name in /etc/passwd for each user. Please note that FreeBSD annd macOS directory name is /var/cron/tabs/.

Viewing contains of /var/spool/cron/crontabs/ directory

Use the ls command and cd command as follows:
$ sudo ls -l /var/spool/cron/crontabs/
For *BSD or macOS Unix, try:
$ sudo ls -l /var/cron/tabs/

Linux var spool cron crontabs files and directory

Linux /var/spool/cron/crontabs/ or BSD /var/cron/tabs/ file listing

From the above outputs, it is clear that users named root and vivek have cron job installed and running on my FreeBSD server. You will get similar outputs on the Linux system too.

Viewing cron job for each user

The crontabs in this directory should not be accessed directly using a text editor or other tools. Instead, the crontab command should be used to access and update them. For example, to see the current users cron jobs, run:
$ crontab -l
Want to see root user cron jobs? Try the sudo command:
$ sudo crontab -l

# do daily/weekly/monthly maintenance
# min	hour	day	month	weekday	command
*/15	*	*	*	*	run-parts /etc/periodic/15min
0	*	*	*	*	run-parts /etc/periodic/hourly
0	2	*	*	*	run-parts /etc/periodic/daily
0	3	*	*	6	run-parts /etc/periodic/weekly
0	5	1	*	*	run-parts /etc/periodic/monthly

Of course, you can use the more command or cat command or less command to view files. But, please do not edit them directory. Instead, always use the crontab command. For example, here is how I can show root user jobs running on my FreeBSD machine:
$ sudo cat /var/spool/tabs/root
But, typing crontab is easier as you don’t have to remember the path:
$ sudo crontab -l -u root
Linux and FreeBSD cron job listing

Editing cron jobs stored in the /var/spool/cron/crontabs/ or /var/spool/tabs/

Again, use the crontab command:
$ crontab -e
$ sudo crontab -e -u root

Understanding crontab command options

  • -l : Show the current crontab on screen.
  • -u {userName} : Specify the name of the user whose crontab is to be tweaked or edited or viewed on screen.
  • -r : Remove the current crontab.
  • -e : Edit the current crontab using the editor specified by the VISUAL or EDITOR environment variables.

Summing up

You learned about /var/cron/tabs/ and /var/spool/cron/crontabs/ directory for personal crontab files under Linux and FreeBSD/macOS Unix systems. Do check the following maual pages using the man command or help command:

man 5 crontab
man 1 crontab
man 8 cron

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.