Explaining Soft Link And Hard Link In Linux With Examples

13 Responses

  1. Kanika says:

    Very clearly explained.

  2. Mike says:

    Great explanation!!! Thanks

  3. chindesh says:

    Simple and clean. Thank you!

  4. Mohammed Firdosh Nasim says:

    Nice explanation. Requesting you to update the following “file permissions (lrwxrwxrwx vs lrwxrwxrwx)” in soft link section to in “file permissions (lrwxrwxrwx vs -rw-r–r–)” .

  5. Excellent explanation! Just a thought: a “mirror copy” implies that both source.file and hardlink.file use different disk space, thus occupping twice as much space (“a copy”), which is wrong.

    Both file names are just different entries in the directory listing to the same “data”, same disk space (identified by an inode), and Linux have a “link count” of file names in every inode. It only erases the inode data when the link count reaches zero.


  6. Sandeep says:

    Great explanation, just one questions, can you please explain that why do we need to create Soft Link or Hard Link, what is the purpose of creating these links. Can you please let me know one scenario for this? Thanks in advance

  7. Hema says:

    My question is, if we update the content in softlink will it reflect to the original file as well?

    • sk says:

      Check it yourself and see if it works. Open the shortcut file in a text editor, add some lines, save and close the file. Now check the contents of source file and symlink.

  8. Tin says:

    Something worth noting is that *editing* a hard linked file will still edit *all* linked files, since they’re actually the exact same file.

  9. Ghalib says:

    what about the size in soft link and hard link takes in time of creation.

  10. rajadurai m says:

    it is very useful to understand the beginners. Thank you

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.