What is the difference between a soft link and a hard link in Unix/Linux?

1 Answers
Answered by suresh

Unix Administrator Interview Question: Difference between Soft Link and Hard Link

Unix Administrator Interview Question: Difference between Soft Link and Hard Link

Soft Links (Symbolic Links):

  • Soft links are references to a file or directory represented by a path.
  • They are separate files that point to the target file using its pathname.
  • If the target file is removed, the soft link is broken.
  • Soft links can span across different file systems.

Hard Links:

  • Hard links are directory entries that point to the same inode as the target file.
  • They are essentially multiple names for the same file.
  • If the original file is removed, the hard link will still refer to the file's data until all references are deleted.
  • Hard links cannot point to directories or across file systems.

In summary, soft links are separate files with their own inode that point to the target file using its pathname, while hard links are additional directory entries that point to the same inode as the target file.

Answer for Question: What is the difference between a soft link and a hard link in Unix/Linux?