CompTIA Linux+ Powered by LPI (LX0-103) — Question 20
After successfully creating a hard link called bar to the ordinary file foo, foo is deleted from the filesystem. Which of the following describes the resulting situation?
Answer options
- A. foo and bar would both be removed.
- B. foo would be removed while bar would remain accessible.
- C. foo would be removed. bar would still exist but would be unusable.
- D. Both foo and bar would remain accessible.
- E. The user is prompted whether bar should be removed, too.
Correct answer: B
Explanation
When a hard link is created, both the original file and the hard link point to the same inode. If the original file foo is deleted, the link bar remains accessible because it still points to the same inode. The other options are incorrect because they either suggest that both files are deleted or that the hard link becomes unusable, which does not happen with hard links.