What is Inode?
metadata about a regular file and directory in Linux.
Let’s create a file with some contents.
How to find Inode information of a file?
In above inode information it is showing
Links : 1.
Create a Hard Link to
Again check the value of
Now Value changed: “Links = 2”.
Check the inode information of hardlink we have created (
Create Soft Link/Symlink:
Check and compare inode and size of
myfile.txt and it’s links.
Now we could see that inode of myfile.txt and myfile_hardlink.txt are same.
Let’s continue. Create a copy of hardlink we have created before:
So copy mean’s, both files don’t have any relation. It’s a COPY.
Create a copy of softlink:
And check size of both links and their copies.
Copy will create a copy of entire contents. It’s a COPY.
Upon creating a hardlink,
Links =2 in inode of the myfile.txt
Let’s remove hardlink and check the value of “Links”:
Links value become 1 again. So the actual content/file info gets deleted/removed only if there are no
See the video demonstration from below: