Hard Links
A hard link is originally a normal directory entry except which instead of pointing to a unique file, Hard links points to an already existing file. This provides the illusion in which there are two identical files whenever a directory listing is complete. Because the system sees the hard-linked file as another file, it treats it as like. This is most apparent in during backups since hard-linked files get backed up as several times as there are hard links to them. Since a hard link shares an inode, that cannot exist across File Systems. A Hard links are made with the ln command. For instance, when a directory listing is performed using ls -l, the result would be as display follows:
-rw--- 1 Krishen unix 42 May 12 13:04 hello
Whenever ln hello goodbye is typed and another directory listing is again performed using ls -l, the subsequent can be observed:
-rw--- 2 Krishen unix 42 May 12 13:04 goodbye
-rw--- 2 Krishen unix 42 May 12 13:04 hello
Remember how this appears as two separate files which just happen to have the similar file lengths. In addition note that the link count (second column) has greater than before from one to two. It can be verified in which both the files are really the similar by using ls -il:
13180 -rw--- 2 Krishen unix 42 May 12 13:04 goodbye
13180 -rw--- 2 Krishen unix 42 May 12 13:04 hello
It can be seen in which both point to the similar inode, 13180.
Note: Care should be taken whenever creating hardlinks particularly when hardlinking to a directory. It is probable to corrupt a filesystem via doing so because the hardlink does not hold the fact in which the i-node being pointed to requires to be treated as a directory.