entries with same inode.
One of the fields in inode called link count field is used to keep track of number of
entries that refer to same inode. Links can also be useful to provide an alternative
name in order to simplify typing of long path name.
There are two kind of links:
- Hard links
- Soft Links
With hard links all the different directory entries point to the same inode.
You can't create hard link to directory, so directory can never have more than
one name and each of filenames must be within same filesystem.
When link count for file equals zero, it means that there are no more directort
entries pointing to an inode. At this point inode data blocks are removed.
e.g: ln bellini /home/rule/compose/bellinih1
above command creates hard link to file 'bellini', in rule\compose directory with
-> Soft links
are also known as symbolic links.
With symbolic links two files are different. One file contains the data and the other
file contains name of original file and acts as pointer or link to it.
One can also make symbolic links to directory, and they can cross different
Every symbolic link has its own inode, and each symbolic link uses an amount
of disk space.
If you delete symbolic link original file is not affected.
creates a soft link for file opera with name opera1 using -s option
command gives the number of links for that particular directory or file in column 2.
to remove the link you use rm command followed by filename