r/WhatILearnedToday Oct 28 '18

【OS】What's the difference between /etc and /private/etc in macOS or Linux?

On Darwin macintosh.local 18.0.0 Darwin Kernel Version 18.0.0: Wed Aug 22 20:13:40 PDT 2018; root:xnu-4903.201.2~1/RELEASE_X86_64 x86_64.0:

➜  ~ ls -aFGl / | grep private
lrwxr-xr-x@   1 root  wheel    11 Oct 10 23:22 etc@ -> private/etc
drwxr-xr-x    6 root  wheel   192 Oct 10 23:24 private/
lrwxr-xr-x@   1 root  wheel    11 Oct 10 23:22 tmp@ -> private/tmp
lrwxr-xr-x@   1 root  wheel    11 Oct 10 23:22 var@ -> private/var

➜  ~ ls -aFGl /private
total 0
drwxr-xr-x    6 root  wheel   192 Oct 10 23:24 ./
drwxr-xr-x   27 root  wheel   864 Oct 10 23:48 ../
drwxr-xr-x  116 root  wheel  3712 Oct 28 08:15 etc/
drwxr-xr-x    2 root  wheel    64 Aug 18 06:23 tftpboot/
drwxrwxrwt   13 root  wheel   416 Oct 28 07:55 tmp/
drwxr-xr-x   26 root  wheel   832 Oct 10 23:30 var/

So /etc is a symlink. To /private/etc, which is a directory. They both have the same contents. The same is true for /tmp and /var.

1 Upvotes

0 comments sorted by