Linux Basics

Difference between Hardlink and Softlink

Difference between Hardlink and Softlink

This post explains the difference between Hardlink and Softlink.

Hardlinks:

Hardlink is a directory entry or a file pointing to the inode of another directory/file. ie., even if you change the name of the other file, the hardlink still point the same file.

To configure Hardlink

 
ln <source file> <destination file>

Softlink:

Softlink is also known as symbolic link and symlink. It is a file that links to another file or directory using its path.

To configure Softlink

 
ls -s <source file> <destination file>

Difference between Hardlink and Softlink

 

                          Hardlinks
                          Softlinks

 

  • Size of the link file is same as the original file
  • Original and link file will have the same inode
  • It cannot be created across partitions
  • Editing of original file will be replicated into the linked file
  • If the original file is deleted then also the link file will be accessible
  • Size of the link file is less than the original file
  • Inode number of the link file will be different
  • It can be created across partitions
  • Editing of original file will be replicated into the linked file
  • If the original file is deleted, the link file will not be accessible

Also ReadHow to delete files older than N Days in Linux

That’s it!

If you like this post and wish to receive more articles from us, please like our FB page: Grepitout

Your suggestions and feedbacks will encourage us and help to improve further, please feel free to write your comments.

For more details on our services, please drop us an E-mail at info@grepitout.com

Topics