Originally Posted by IMAX
$ls / -1ia
Why Unix/Linux assigned same inode number on the root dir?
What`s advantage of that design?
How about set NULL with its ".." inode number 2?
A directory structure is implemented as a tree. Each directory has an entry that points to the data that describes the files listed - basically, the data is a list of pairs: inode number and file name.
The pointer to the directory file is the "." entry.
For management handling, each directory also has a pointer to its parent. This entry is named ".."
Since the root directory (commonly referred to as "/") must have both entries the easiest way to know if you are at the root entry is to have both ".", and ".." point to the same inode.
This also makes the relative file naming specification "../directory", work even if you are in the root directory, and without any special handling that would be necessary if the parent directory were listed as NULL.