I have read lots of posts on What is the difference between soft and hard link but still am a bit vague on the difference. I wonder could somebody give just one or two example(s) of when you would want to use a Hard link instead of a soft? Just a real world example to help people understand.

The answers in the above link may be thorough, but they may be too complex they are for me to really grasp WHY I would want to use one or the other. Also, they are just a bit complex in general :P.

I think this question could help me and a lot of others understand the answers in the link above.


In short: don't bother using the hard links.

Hardlink are rarely used (maybe due to legacy unix bugs, who knows), so let see the advantages of hard links, and what scenario could require that feature.

  1. less space consumption (just the inode entry): could be useful if your requirements impose usage of gazillions of links
  2. file reference counting: Within the same filesystem, you can create multiple directory structures containing hard-linked files. It enables you to:

    • have multiple thematic directory structures (Docs/House/Taxes/fx2015.pdf vs Docs/Taxes/2015/fx.pdf)
    • even create backup snapshots as seen here
    • reorganize, rename and delete your documents without naming troubles

Ohh.. you think it's nice ? perfect directory structures for me ? well no.. It will depends on the application used, but when some paranoïd application will save your files, they will do, instead of overwriting it :

  • create a new file and write to that file
  • on success : swap the new and existing file with renaming, delete the old file
  • on failure, data is left unchanged

So, your multiple file names pointing to the same data are now pointing to different data, and you simply cannot tell the difference.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.