Translation(s): English - Fran├žais - Italiano


ln makes links between files.

There are two concepts of link in Unix-like OS (this includes Linux), usually called "hard link" and "soft link":

By default, ln makes hard links between files; with the -s option, it makes symbolic (or `soft') links.

If only one file is given, it links that file into the current directory, that is, creates a link to that file in the current directory, with name equal to (the last component of) the name of that file. (This is a GNU extension.) Otherwise, if the last argument names an existing directory, ln will create links to each mentioned source file in that directory, with a name equal to (the last component of) the name of that source file. (But see the description of the --no-dereference option below.) Otherwise, if only two files are given, it creates a link named dest to the file source. It is an error if the last argument is not a directory and more than two files are given.

By default, ln does not remove existing files or existing symbolic links. (Thus, it can be used for locking purposes: it will succeed only if dest did not exist already.) But it can be forced to do so with the option -f.

On existing implementations, if it is at all possible to make a hard link to a directory, this may be done by the superuser only. POSIX forbids the system call link(2) and the utility ln to make hard links to directories (but does not forbid hard links to cross filesystem boundaries).