ls -la on the
Volumes directory. It shows the
MM dir to have 9 hard links and the
Media dir to have 12. If I then
cd to the
MM directory and run
ls -la, it shows only 7 items whereas if I
cd to the
Media dir, it has 12 as expected. Why does the
MM dir have only 7 items? shouldn't it be 9?
Every directory has at least two references: one from its parent directory (the
Volumes entry in
/), and one from its own
If there are subdirectories, each has a
.. entry that refers back to the parent, and those also contribute toward the parent's link count.
/Volumes directory's link count of 9 consists of one from
/, plus one from itself, plus 7 from subdirectories.
. represents the current directory, where as
.. represents the parent directory.
For example, currently I am in
$cd demo/dir1 $pwd /home/guru/demo/dir1 <- my current directory $cd . $pwd /home/guru/demo/dir1 <- cd again to my current directory cd .. $pwd /home/guru/demo <- cd to parent directory