Possible Duplicate:
Why does '/' have an '..' entry?
I understand that in the filesystem hierarchy starting with / as top-level directory, under which all the other sub directories or files are stored. In each subdirectory, we see two special directories referred as .
and ..
which are special because they are hardlinks pointing to the current directory inode and the parent directory inode respectively. They are common for every sub directory in the filesystem. However, when I look at /
, those two special directories behaviour changes. They refer to the /
again.
For example:
[root@centos /]# pwd
/
[root@centos /]# ls -ldi . ..
2 drwxr-xr-x 26 root root 4096 Dec 3 16:53 .
2 drwxr-xr-x 26 root root 4096 Dec 3 16:53 ..
[root@centos /]# cd root
[root@centos ~]# ls -ldi . ..
195265 drwxr-x--- 10 root root 4096 Dec 3 20:33 .
2 drwxr-xr-x 26 root root 4096 Dec 3 16:53 ..
[root@centos ~]#
I want to understand what part of the filesystem controls this? But how is this done in detail. Can someone please explain this behaviour? (Let me guess, this is part of the kernel's filesystem management routines). I have my own theory about this but would like to listen more from the experts here.
Cheers.