I know the underlying principle or the theory difference of symbol link and hard link. But I am still confused with the usage or apply scenarios of them.
Where 'ln' or 'ln -s' is often used by using Linux?Who can give me some examples?
I know the underlying principle or the theory difference of symbol link and hard link. But I am still confused with the usage or apply scenarios of them.
Where 'ln' or 'ln -s' is often used by using Linux?Who can give me some examples?
a hard link (ln) is a link to the inode as where the softlink (ln -s) points to the actual file. The main difference is if you change the file name or move the original file, the softlink will not know where to go. The hard link will still point to that file.
Try this: create a file 'foo' and softlink it to 'bar', then change the name of foo to 'foo1'. You will get an error when you try to cat foo.
Do it with a hard link and you will not get that error because it points to the same inode.