When we create a directory in UNIX it has 2 hard links: .
and ..
.
One to itself and another one to its parent directory.
As I read the .
increases counter of the directory, and the ..
increases hard links counter of parent directory.
So only .
is counted in the directory, but there are still 2 hard links when I do ls -l
.
What is the second one?
Can someone tell me how hard links are counted in directories?
Imagine, we have this hierachy:
parent - 4 hard links
.
. child_1 - 2 hard links
.
. child_2 - 2 hard links
/
has..
. It's just that it points to itself. – Chris Davies Dec 23 '15 at 10:27