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?

1 Answer 1

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.

0

You must log in to answer this question.

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