问题描述
ls -ai
命令显示。
和 ..
它们的inode分别与当前目录和父目录相同。
The ls -ai
command shows that .
and ..
have their inodes same as current directory and parent directory, respectively.
任何人都可以告诉我究竟是什么。
和 ..
是?
Could anyone tell me what exactly .
and ..
are?
他们是真实的文件甚至硬链接?但是如我所知,不允许创建一个硬链接到目录。
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.
推荐答案
他们是特殊的名称 - 尽管它们不是真正的硬链接,但它确实算作硬链接(它们确实增加了链接数),因为正如你所说,目录不能有硬链接。在这里阅读更多:
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)
这篇关于什么是双点(..)和单点(。)在Linux?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!