3

I know that hard link can not point to directories but when i create an empty directory and execute stat command for it

enter image description here

links=2 ,I search for symbolic links

enter image description here

There is not another link. why for directory the default numbers of links=2?

4

Short answer:

The number of links to a directory is at least two:

  • The link to the parent directory
  • The link to itself

See also here:

The number of links is the number of hard links to the file. For a directory, the number of hard links is the number of (immediate) subdirectories plus the parent directory and itself.

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.