I have a doubt regarding what are the differences when we make a new file using touch command and when we make a new hard-link to a file. It would be nice for me if you can explain me it in detail.
migrated from stackoverflow.com May 3 '11 at 14:40
|
Creating a new hard link (using |
|||
|
|
|
'touch' creates a new file, while a hard link is just another name for the same file. Try it with the following commands:
Check the contents: file1.txt and file2.txt should both contain one line. file3.txt and file4.txt both contain two lines. |
|||
|
|
|
Links don't allocate a new inode, other entries do. You can find out the inode number for files using
(or To find a file with a given inode number:
Inodes are unique only withing a filesystem Hardlinking is only possible within a single filesystem |
|||
|
|

man lnandman touch. These commands are not related in any way. – sehe May 3 '11 at 14:00