How to Create/delete Softlink & Hardlink

A link is nothing more than a way of matching two or more file names to the same set of file data.

How to create softlink

A soft link, or more common, a symlink, is link a shortcut to the targeted file or directory. So when is removed the original target stays present. This is the opposite of a hard link which is a reference to the target and so, if the hard link is removed, so is the target.

# ln -s /directory/ xymon

How to delete the softlink

#unlink xymon

How to create hardlink

Hard links are essentially a file with multiple names. Hard links share the same data blocks on the hard disk (have the same inode), while they continue to behave as independent files. If one of the hard links is deleted, the hard link count decreases by one. When all hard links are deleted, the data ceases to exist.

# ln -i /directory/file hardlink/file

How to delete the hardlink

#rm hardlink/file
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

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