LN(1) SysV LN(1)
NAME
ln - create a hard or soft link
SYNOPSIS
ln name [ target ]
ln -s name target
ln name ... directory
DESCRIPTION
ln creates both hard and soft links. A link is a directory entry that
refers to a file. You can have several links, in one or more
directories, to the same file. Changes to a file are effective whether
or not the file is referenced through a link.
A hard link is indistinguishable from the original directory entry. Hard
links may not span file systems and may not refer to directories.
A soft (or symbolic) link contains a pathname. Symbolic links may span
file systems and may refer to directories.
An open(2) operation on a link opens the referenced file. A stat(2) on a
soft link is equivalent to a stat on the file that the link points to.
Use lstat(2) to obtain information about the link itself. The
readlink(2) call is useful for reading the contents of a soft link.
Given one or two arguments, ln creates a link to an existing file name.
If target is given, the link has that name. The target argument may also
be a directory in which to place the link. If target is not a directory,
the link is placed in the current directory.
When the -s option is used, ln requires that a target be specified. If
target exists, ln -s will fail. If only the directory is specified, the
link is made to the last component of name.
Given more than two arguments, ln makes links to all the named files in
the named directory. The links made will have the same name as the files
being linked to.
OPTIONS
-f Forces creation of the link if permitted by access modes (hard
links only).
-s Creates soft (symbolic) links.
NOTES
By default, ln generates a hard link.
Domain/OS symbolic links are implemented in the parent directory object,
not in separate files. Because of this, symbolic links created in the
same directory will share the creation/modification information for the
most recently created symbolic link.
SEE ALSO
cp(1), mv(1), rm(1), link(2), readlink(2), lstat(2), stat(2).