Difference Between Hard link and Soft link

Computer NetworkData StorageDatabase

In this post, we will understand the difference between a hard link and a soft link −

Hard link

  • A file that has a hard link can be accessed using multiple names.

  • These names are known as hard links.

  • Once the file is deleted, the link would still be valid.

  • The file can be accessed even after it has been deleted.

  • The command used to create a hard link is ‘ln’.

  • The inode number remains the same.

  • It can be linked to its own partition.

  • It consumes less memory.

  • It doesn’t have a relative path.

Soft link

  • A file can be accessed through many references.

  • All of this point to a specific file known as a soft link.

  • Once the original file has been deleted, the link becomes invalid.

  • The inode number is different.

  • The command to create a soft link is ‘ln –s’.

  • It consumes more memory.

  • It has a relative path.

  • It can be linked to other file systems, and can be networked too.

Updated on 16-Apr-2021 07:50:34