B*********s 发帖数: 292 | 1 两者什么区别?
如果我ln了一个目录到当前目录,那么我删除的时候,删除的是这个link呢,还是那个
目录下的真文件?
惭愧惭愧,这都是linux基本知识,却没有掌握好。 | S*A 发帖数: 7142 | 2 There are two kinds of link:
symbol link & hard link.
symbol link is just point to a differnt file/directory name.
hard link directly point the same inode struct, also increase
the inode reference count.
symbol link, if you remove the link, it just remove the pointer.
It does not harm to your real file. Also if people remove the
real file, you symlink is invalid.
hard link, if you remove either of the file, only remove the
directory entry, and decrease the reference count on inode.
when the inode reference count drop to zero, the file get
deleted. That is why inside the kernel, the remove system
call is actually call unlink.
【在 B*********s 的大作中提到】 : 两者什么区别? : 如果我ln了一个目录到当前目录,那么我删除的时候,删除的是这个link呢,还是那个 : 目录下的真文件? : 惭愧惭愧,这都是linux基本知识,却没有掌握好。
|
|