A hard link is a directory entry that associates a name with a file on a file system. It allows multiple filenames to point to the same data on disk, sharing the same inode number. This means that both the original file and the hard link are essentially the same file, and changes made to one will be reflected in the other.
Key characteristics of hard links include:
- They share the same inode as the original file.
- They cannot link to directories.
- They cannot cross file system boundaries.
- They continue to work even if the original file is deleted or moved.
- Changes to the content are reflected in all hard links.
To create a hard link, you can use the ln command in Linux. For example:
ln original.txt hardlink.txt
This command creates a hard link named hardlink.txt that points to the same data as original.txt.
