Javatpoint Logo
Javatpoint Logo

Hard Links


Creating Hard Links

Hard links for any file can be created with command ln. One extra hard link file will be created in the respective directory.

Linux Hard Links1

Look at the above snapshot, we have created a hard link for the file xyz in the directory new1.

The original file and hard linked file both contain the same Inode number and hence, they have the same permissions and same owners. Content will also be the same for both the files. In short, both the files are equal now, but if original file will be removed then hard link file will not be affected.


Finding Hard Links

A hard link can be find with find command by specifying the Inode number. Inode number is always unique to its partition.

Example:

Linux Hard Links2

Look at the above snapshot, we have found hard link files with command "find / -inum 662786 2> /dev/null" for the Inode number 662786.

Next TopicSymbolic Links




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA