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?

Sinoosh
  • 2,101

1 Answers1

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.

Jacob Vlijm
  • 85,475