Ln (Unix)
|
- The title of this article is incorrect because of technical limitations. The correct title is "ln".
The ln command is used on Unix-like systems to create links between files. Links allow more than one location to refer to the same information.
There are two types of links; both are created by ln.
- Symbolic links, which refer to a symbolic path indicating the abstract location of another file.
- Hard links, which refer to the specific location of physical data.
Usage
The general syntax for the ln command is:
ln [-s] target [name]
The target parameter indicates the location or file to which the link should point. The optional name parameter specifies the name that link should be given. If no name is specified, the basename of the target will be used. The ln utility creates hard links by default; the -s option indicates that a symbolic link should be created instead.
Examples
ln abc xyz
Creates a hard link called abc whose target is the same as that of the existing file xyz.
ln -s /usr/share/pixmaps/image.jpg
Creates a symbolic link that points to the path /usr/share/pixmaps/image.jpg. The link would be named image.jpg because that is the basename of its target.