[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
ln
: Make links between files
ln
makes links between files. By default, it makes hard links;
with the `-s' option, it makes symbolic (or soft) links.
Synopses:
ln [option]... target [linkname] ln [option]... target... directory |
ln
creates a
link to each target file in that directory, using the
targets' names. (But see the description of the
`--no-dereference' option below.)
ln
creates a link from the
second to the first.
ln
creates a link to that
file in the current directory.
ln
will not remove an existing file. Use the `--backup'
option to make ln
rename existing files.
A hard link is another name for an existing file; the link and the original are indistinguishable. Technically speaking, they share the same inode, and the inode contains all the information about a file--indeed, it is not incorrect to say that the inode is the file. On all existing implementations, you cannot make a hard link to a directory, and hard links cannot cross filesystem boundaries. (These restrictions are not mandated by POSIX, however.)
Symbolic links (symlinks for short), on the other hand, are a special file type (which not all kernels support: System V release 3 (and older) systems lack symlinks) in which the link file actually refers to a different file, by name. When most operations (opening, reading, writing, and so on) are passed the symbolic link file, the kernel automatically dereferences the link and operates on the target of the link. But some operations (e.g., removing) work on the link file itself, rather than on its target. See section `Symbolic Links' in The GNU C Library Reference Manual.
The program accepts the following options. Also see 2. Common options.
When the destination is an actual directory (not a symlink to one),
there is no ambiguity. The link is created in that directory.
But when the specified destination is a symlink to a directory,
there are two ways to treat the user's request. ln
can
treat the destination just as it would a normal directory and create
the link in it. On the other hand, the destination can be viewed as a
non-directory--as the symlink itself. In that case, ln
must delete or backup that symlink before creating the new link.
The default is to treat a destination that is a symlink to a directory
just like a directory.
Examples:
ln -s /some/name # creates link ./name pointing to /some/name ln -s /some/name myname # creates link ./myname pointing to /some/name ln -s a b .. # creates links ../a and ../b pointing to ./a and ./b |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |