Go to the first, previous, next, last section, table of contents.

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]... source [dest]
ln [option]... source... directory

If the last argument names an existing directory, ln links each source file into a file with the same name in that directory. (But see the description of the `--no-dereference' option below.) If only one file is given, it links that file into the current directory. Otherwise, if only two files are given, it links the first onto the second. It is an error if the last argument is not a directory and more than two files are given. By default, it does not remove 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 links to directories, 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; in particular, 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 GNU C library.

The program accepts the following options. Also see section Common options.

Make backups of files that are about to be overwritten or removed. See section Backup options.
Allow the super-user to make hard links to directories.
Remove existing destination files.
Prompt whether to remove existing destination files.
When given an explicit destination that is a symlink to a directory, treat that destination as if it were a normal file. 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.
Make symbolic links instead of hard links. This option merely produces an error message on systems that do not support symbolic links.
Print the name of each file before linking it.
`-S suffix'
Append suffix to each backup file made with `-b'. See section Backup options.
`-V method'
Change the type of backups made with `-b'. The method argument can be `numbered' (or `t'), `existing' (or `nil'), or `never' (or `simple'). See section Backup options.

Go to the first, previous, next, last section, table of contents.