问题描述
ls -ai
命令显示 .
和 ..
的 inode 分别与当前目录和父目录相同.
The ls -ai
command shows that .
and ..
have their inodes the same as the current directory and parent directory, respectively.
.
和 ..
究竟是什么?
它们是真实的文件还是硬链接?但据我所知,不允许创建指向目录的硬链接.
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.
推荐答案
它们是特殊的 name-inode 映射,尽管它们不是真正的硬链接,但它们确实算作硬链接(它们确实增加了链接数),因为,正如你所说,目录不能有硬链接.在此处阅读更多信息:硬链接和 Unix 文件系统节点 (inode)
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 中的双点(..)和单点(.)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!