Search code examples
linuxfileunixdirectory

What is double dot(..) and single dot(.)?


The ls -ai command shows that . and .. have their inodes the same as the current directory and parent directory, respectively.

What exactly are . and ..?

Are they real files or even hard links? But as I have known, it's not allowed to create a hard link to a directory.


Solution

  • They are special name-inode maps which do count as hard-links (they do increase the link-count) though they aren't really hard-links, since, as you said, directories can't have hard-links. Read more here: Hard links and Unix file system nodes (inodes)