Hard links are the original Unix way of creating a link. By defaults, every file has a single hard link that gives the file its name. When we create a hard link, we create an additional directory entry for a file. Hard links have two important limitations.
- Hard links cannot reference a file outside its own file filesystem.
- A hard link cannot reference a directory
Keep in mind that a directory list containing a hard link will not show any special indication of the link or links. And, when a hard link is deleted, the contents of the file will continue to exist.. Unless space is deallocated.
Symbolic links are the new and more modern way of creating links. Symbolic Links were created to overcome the limitations of hard links..two distinct disadvantages are:
- Hard links cannot span physical devices
- Hard links cannot reference directories, only files.
Symbolic links are a special type of file that contains a text pointer to the target file or directory. Creating them is similar to creating a hard link. (We’ll talk about that later on) If you write something to a symbolic link, a reference file will be written as well. If the symbolic link is deleted, only the link is deleted. If a file is deleted, then the link will continue to exist. However, the link will point to nothing.