What is the difference between a hard link and a symbolic link?
In Unix file systems it is possible to create hard links and symbolic links, what are they? and what is the difference between them?
First
Each file has its own inode and in this inode are stored the file’s attributes (owner, permissions, last modifications’ time); files all have link to their inode.
Hard links:
A hard link is simply another link to the file’s inode, the command to create a hard link is ln : ln filename1 linkname1
Soft/symbolic links:
A soft link is a link to another link in the file system, the command to create a soft link is ln -s : ln -s filename1 linkname1
The difference
The difference between a hard link and a soft link (symbolic link) is pretty simple; whereas a soft link is an actual link of the original file, a hard link is a mirror copy of the original. Otherwise speaking if you delete the original file, the soft link has no value.However in the case of a hard link it is entirely the opposite; if you delete the original file the hard link will still have the data in it.
In other words, the tow types of links have different purposes. In order to use them well, you have to understand the difference.