|
ln is a program on Unix and Unix-like systems that provides filesystem links.
A link is a file that "stands in" for another. For example, if there is a directory, say /usr/local/bin/somewhat/docs
that you use frequently, you could create a directory in your home directory (your own file area) and then make a link from the above directory to your own, e.g. by issuing ln -s /usr/local/bin/somewhat/docs docs, creating a new docs (symbolic, see below) link to the former directory.
Links on Unix come in two types: hard links and symbolic links. A hard link is, for all intents and purposes, another name for a file. Hard links between files can be placed in different directories as long as they remain on the same physical partition. The file is deleted only when all hard links to that file are deleted and all hard links to a file are considered equal. Technically, hard links refer to the same file inode, whilst symbolic links do not.
A symbolic link, or symlink, on the other hand, is a small file that tells the operating system where to find the target of that link. This is similar to the shortcut on Microsoft Windows, although since symlinks are implemented at the kernel level in Unix they behave more transparently. A symlink's target can be anywhere on the filesystem, unlike hard links which must be on the same partition. Deleting the target of a symlink renders the symlink invalid. Deleting the symlink does not affect the target.
Analogues of symbolic links on other operating systems include the shortcut (Microsoft Windows), alias (Mac OS), and shadow (OS/2).
See also
|