Explore BrainMass

Hard and soft linking on Unix/Linux

Give the advantages and disadvantages/limitations of hard and soft linking in Unix/Linux filesystem.

© BrainMass Inc. brainmass.com July 18, 2018, 3:18 am ad1c9bdddf

Solution Preview

In Unix/Linux files can be linked in two ways -

1. Hard links

Hard linking of files is achieved by "ln filename linkname". At the end of it both - filename and linkname, point to the same inode and the same data blocks.


a. Each hard link to file has exactly the same status (size, ownership, permissions etc.) as any other hard link to it or the file itself. Any modification to one automatically reflects in another. Semantically speaking, linkname is just an alias for filename.

b. Each hard link to the original file, takes only an extra entry in the directory file, not an extra inode.

c. In you accidentally deleted the original file (it's entry in corresponding directory), you don't have to panic. You still have the access to file contents via the hard link(s) you had created earlier. "ln linkname filename" will restore ...

Solution Summary

Solution presents a well researched document giving 3-4 distinctive advantages and 3-4 limitations/disadvantages for each of the hard and the soft links.