A symbolic link contains a text string that is automatically
interpreted and followed by the operating system as a path to another
file or directory. This other file or directory is called the "target".
The symbolic link is a second file that exists independently of its
target. If a symbolic link is deleted, its target remains unaffected. If
a symbolic link points to a target, and sometime later that target is
moved, renamed or deleted, the symbolic link is not automatically
updated or deleted, but continues to exist and still points to the old
target, now a non-existing location or file. Symbolic links pointing to
moved or non-existing targets are sometimes called broken, orphaned, dead, or dangling.
Symbolic links are different from hard links. Hard links do not link paths on different volumes or file systems, whereas symbolic links may point to any file or directory irrespective of the volumes on which the link and target reside. Hard links always refer to an existing file, whereas symbolic links may contain an arbitrary path that does not point to anything.
One of the common uses of symbolic links is to make mounted file systems accessible from a different directory. For instance, you may have a large directory that has to be split over several physical disks. For clarity, you can mount the disks as /disk1, /disk2, etc., and then link the various subdirectories in a way that makes efficient use of the space you have.
The reason why hard links are sometimes used in preference to symbolic links is that some programs are not fooled by a symbolic link: If you have, say, a script that uses cp to copy a file, it will copy the symbolic link instead of the file it points to. [ cp actually has an option to override this behavior.] A hard link, however, will always be seen as a real file.
Symbolic links are different from hard links. Hard links do not link paths on different volumes or file systems, whereas symbolic links may point to any file or directory irrespective of the volumes on which the link and target reside. Hard links always refer to an existing file, whereas symbolic links may contain an arbitrary path that does not point to anything.
One of the common uses of symbolic links is to make mounted file systems accessible from a different directory. For instance, you may have a large directory that has to be split over several physical disks. For clarity, you can mount the disks as /disk1, /disk2, etc., and then link the various subdirectories in a way that makes efficient use of the space you have.
The reason why hard links are sometimes used in preference to symbolic links is that some programs are not fooled by a symbolic link: If you have, say, a script that uses cp to copy a file, it will copy the symbolic link instead of the file it points to. [ cp actually has an option to override this behavior.] A hard link, however, will always be seen as a real file.