Hard Links in Linux
Hard links are links which points to an inode of a file.
Now what are inodes ?
Inode is a number which is assigned to a file or folder as a universal identifier inside a system. For example:
Output:
Explanation:
Under the Blocks attribute we see "Inode" which shows a specific number, this number is the original identifier of the file in the whole system.
Under inode there is information regarding the data's permissions and access time all of which is stored inside blocks of data.
When we create a file we store some information in it, we tell linux to store this information under a file name.
Major benifit from hardlinking is that a file can be accessed by multiple users at the same time without making two copies of it at different locations.
Limitations to hardlinks in linux
Hardlinks can only be made for files to files and never directory to directory or file to directory or vice versa.
You cannot create hardlinks between different filesystems, for example creating a hardlink between your local disk and your external disk will not work.
While making hardlinks it is important to have apropriate permissions to access the file properly.
Creating hardlinks:
Last updated