1

I'm familiar with the 3 file mode 'bits' defining user, group, and other permissions as well as the setuid/setgid/sticky 'bit', but when I stat the root level directories on my MacOSX laptop I see 1 to 2 extra fields. What are these?

 [onlyanegg@macosx ~]$ stat -f '%p %N' /*
 40775 /Applications
 40755 /Library
 40755 /Network
 40755 /System
 40755 /Users
 41777 /Volumes
 40755 /bin
 41775 /cores
 40555 /dev
120755 /etc
 40555 /home
100644 /installer.failurerequests
 40555 /mnt
 40555 /net
 40775 /opt
 40755 /private
 40755 /sbin
120755 /tmp
 40755 /usr
120755 /var
3

stat(1) specifies that %p requests

File type and permissions.

(look for "datum" in the linked page). The value displayed is all of st_mode (see stat(2):

 #define S_IFMT 0170000           /* type of file */
 #define        S_IFIFO  0010000  /* named pipe (fifo) */
 #define        S_IFCHR  0020000  /* character special */
 #define        S_IFDIR  0040000  /* directory */
 #define        S_IFBLK  0060000  /* block special */
 #define        S_IFREG  0100000  /* regular */
 #define        S_IFLNK  0120000  /* symbolic link */
 #define        S_IFSOCK 0140000  /* socket */
 #define        S_IFWHT  0160000  /* whiteout */
 #define S_ISUID 0004000  /* set user id on execution */
 #define S_ISGID 0002000  /* set group id on execution */
 #define S_ISVTX 0001000  /* save swapped text even after use */
 #define S_IRUSR 0000400  /* read permission, owner */
 #define S_IWUSR 0000200  /* write permission, owner */
 #define S_IXUSR 0000100  /* execute/search permission, owner */

This explains the values you're getting:

  • values starting with 4 are directories (/Applications, /Library...)
  • values starting with 12 are symbolic links (/etc, /tmp, /var)
  • values starting with 10 are regular files (/installer.failurerequests)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.