Linux Tricks and Techniques

For Linux Experts

Use the website for easy leaning of Linux

Tuesday, 31 May 2016

Soft Link and Hard Link in Linux

Soft Link and Hard Link 

Soft Link : A soft link is the file that have the information to point to another file/inode. That inode points to the data on hard drive. A soft link do have different i nodes and there is no role of the link counter while creating a soft link. In the soft link if we delete the original file then this link will not work. To create a soft link type a simple command.

# ln -s source target

e.g. ln -s /usr/sbin/clear /usr/sbin/c

Hard Link: A Hard link is the direct pointer to the original inode of the original file. If we compare the original file and hard link both will be same. The hard link works even after deleting the original file. In hard link inode number remains the same. The link counter will either increase or decrease in this link but these should be in the same partition. To create a hard link type simple command.

# ln source target

e.g. ln /usr/sbin/clear /usr/sbin/c

To remove these link 

# rm linkname


No comments:
Write comments