Bird
0
0

Given the command ls -i /tmp shows inode 12345 for a file named 'tempfile', what happens if you delete 'tempfile' but a hard link to it still exists?

medium📝 Command Output Q5 of 15
Linux CLI - Disk and Storage
Given the command ls -i /tmp shows inode 12345 for a file named 'tempfile', what happens if you delete 'tempfile' but a hard link to it still exists?
AThe file content is lost
BThe inode is deleted immediately
CThe inode and data remain accessible via the hard link
DThe hard link becomes invalid
Step-by-Step Solution
Solution:
  1. Step 1: Understand inode reference counting

    Inodes track how many links point to the file; deleting one link reduces count but does not remove data if others exist.
  2. Step 2: Effect of deleting one hard link

    Since a hard link still exists, the inode and data remain accessible through it.
  3. Final Answer:

    The inode and data remain accessible via the hard link -> Option C
  4. Quick Check:

    Inode persists while links exist [OK]
Quick Trick: Inode stays until all hard links are deleted [OK]
Common Mistakes:
  • Assuming inode deletes when one link is removed
  • Thinking file content is lost immediately
  • Confusing hard links with symbolic links

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes