Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the file menu if I go to chmod, it returnes the chmod value for the folder / file.

I understand the last 3 digits, the second is setuid/setgid/sticky bit (have read the docs on it but its use is not that clear to me)... and then there is the first digit which I guess is for file/folder and what else? Like for a folder the digit is 4, for file 0... what about the 2 and 6? I checked that the symbolic link doesn't have a separate chmod first digit value.

share|improve this question
    
Can you provide the actual text from the documentation that describes ths feature? – Ramhound Nov 4 '13 at 14:19
up vote 0 down vote accepted

chmod, as you probably know, is short for “change mode”.  “mode” here refers to the st_mode field in the inode.  stat(2), the man page for the stat, fstat, and lstat system calls, shows st_mode values of up to seven digits.  Here’s an excerpt:

   S_IFSOCK   0140000   socket
   S_IFLNK    0120000   symbolic link
   S_IFREG    0100000   regular file
   S_IFBLK    0060000   block device
   S_IFDIR    0040000   directory
   S_IFCHR    0020000   character device
   S_IFIFO    0010000   FIFO

OK, the first digit is always zero, to indicate that the number is octal; we can ignore that.  MC seems to be ignoring the second one too.  So you can see that regular files have 0 for the third (i.e., the fifth from the right) digit, and directories have 4.   2 and 6 are character device and block device, respectively; you should see these only in /dev.  Named pipes should be 1, and file system sockets should be 4.    If symbolic links are displaying as 0, that’s odd; maybe somebody thought that displaying 2 would be too confusing.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .