IT Questions and Answers :)

Wednesday, July 11, 2018

In Linux, what's the difference between a hard link and a symbolic link?

In Linux, what's the difference between a hard link and a symbolic link?

  • A hard link does not depend on software libraries, a soft link does.
  • A hard link persists across OS reboots, a symbolic link does not.
  • Normal users can use only symbolic links, only the "root" user can use hard links.
  • A hard link points to a file's inode, a symbolic link is a pointer to the file. 

In Linux, what's the difference between a hard link and a symbolic link?

EXPLANATION

Symbolic links are much more common than hard links. They are aliases to an already existing file, and deleting the symbolic link will leave the existing file intact.
Renaming the file will break the link.  Hard links point to the very same filesystem inode used by the target file, so renaming the target file will have no effect on the hard link-- it will still point to the original file.  If for some reason the file targeted by a hard link is moved to a different spot in the filesystem, the hard link will no longer be valid.  Symbolic links are much more common than hard links.
Share:

0 comments:

Post a Comment

Popular Posts