- Hard Links
- Symbolic or Soft Links
A hard link is another name for an existing file and is indistinguishable from the file it is linked to.If a file is altered any hard links to it are also altered ; and conversely, altering any hard link will also alter the original file and any other hard links that it may have.However if the original file is removed , any hard links will still contain the contents of the original file. This is because a hard link is another INSTANCE of the file it points to.
Hard Links have two limitations:
- Hard Links cannot be created across file-systems.
- Hard Links cannot be created for directories, even if, those directories exist within the same file-system.
Each file on the system has at least one hard link, which is the original file name itself. Directories always have at least two hard links - the directory name itself( which appears in the parent directory) and the special file, inside the directory.Likewise , when a new sub-directory is created, the parent directory gains a new hard link for the special file... inside the new sub-directory.
If a hard link is removed, the original file and its other hard links are not removed; and conversely, even if the original file is removed, its hard links still remain intact.
Symbolic or soft links:
Symbolic Links or soft links are pointers to a file that exists elsewhere.A symbolic link passes most operations( such as reading and writing) to the file it points to.Symbolic Links are identified in file listingswith an "l" in the first character of the first column, and , by default, are output as cyan in colour listings.
If a symbolic link is deleted only the link is deleted and not the original file . However, if the original file is deleted and replaced with another file, the symbolic link will point to the contents of the new file.
As opposed to hard links , symbolic links can be created across filesystems. Also, we can create symbolic links for directories.
Windows shortcuts are an excellent example of symbolic links.