LN(1) BSD Reference Manual LN(1)NAMEln - make links
SYNOPSISln [-fs] file [link_name]
ln [-fs] file ... [directory]
DESCRIPTION
The ln utility creates a new directory entry, i.e. a new name in the
filesystem. There are two types of links: hard links and symbolic links.
By default ln makes hard links. A hard link to a file is indistinguish-
able from the original file, for example, the link has the same file per-
mission modes as the original file. This permits multiple names for a
file without using up filesystem space for multiples copies of the file.
Any changes made to the file are independent of the name used to refer-
ence the file. Removing the file (by any name) will not remove the
file's contents until the removal of the last name for the file.
Hard links may only refer to existing files, may not refer to directories
and may not span file systems.
A symbolic link contains the name of the file to which it is linked, and
should be thought of as an indirection instead of as a copy. This indi-
rection is accomplished automatically by the system, e.g., the command
``cat symbolic_link'' will display the file the symbolic link references,
and not the symbolic link itself. This permits multiple names for files
as well as short-hand paths for long directory paths, e.g., ``/sys'' for
``/usr/src/sys/''. Removing the symbolic link will remove only the link,
and will not delete the file's contents.
The owner, group, permissions, modification time, etc. of a symbolic link
are taken from the directory in which it resides, and are therefore not
useful or meaningful. Symbolic links may refer to (currently) nonexis-
tent files, span file systems, and refer to directories.
The options are as follows:
-f Unlink any already existing file with the same name as the link
file, permitting the link file to be created.
-s Create a symbolic link instead of the default hard link.
Given one argument, ln creates a link to the file file, in the current
directory. The link is named with the last component of file.
Given two arguments where the second argument is not a directory, ln cre-
ates a link to the file file, named link_name.
Given two or more arguments where the last argument is a directory, ln
creates links to the file arguments, in the specified directory. Each
link is named with the last component of the respective file argument.
Some system calls reference the symbolic link itself; see readlink(2) and
stat(2) for further information. For an exhaustive discussion of symbol-
ic links, their similarities and differences with hard links, and their
behavior in the system, see symlink(7).
SEE ALSOlink(2), lstat(2), readlink(2), stat(2), symlink(2), symlink(7)HISTORY
A ln command appeared in Version 6 AT&T UNIX.