ln

v0.0.26
ln [OPTION]... [-T] TARGET LINK_NAME
ln [OPTION]... TARGET
ln [OPTION]... TARGET... DIRECTORY
ln [OPTION]... -t DIRECTORY TARGET...

Make links between files.

Options

--backup=<CONTROL>

make a backup of each existing destination file

-b

like --backup but does not accept an argument

--force, -f

remove existing destination files

--interactive, -i

prompt whether to remove existing destination files

--no-dereference, -n

treat LINK_NAME as a normal file if it is a symbolic link to a directory

--logical, -L

follow TARGETs that are symbolic links

--physical, -P

make hard links directly to symbolic links

--symbolic, -s

make symbolic links instead of hard links

--suffix=<SUFFIX>, -S <SUFFIX>

override the usual backup suffix

--target-directory=<DIRECTORY>, -t <DIRECTORY>

specify the DIRECTORY in which to create the links

--no-target-directory, -T

treat LINK_NAME as a normal file always

--relative, -r

create symbolic links relative to link location

--verbose, -v

print name of each linked file

In the 1st form, create a link to TARGET with the name LINK_NAME. In the 2nd form, create a link to TARGET in the current directory. In the 3rd and 4th forms, create links to each TARGET in DIRECTORY. Create hard links by default, symbolic links with --symbolic. By default, each destination (name of new link) should not already exist. When creating hard links, each TARGET must exist. Symbolic links can hold arbitrary text; if later resolved, a relative link is interpreted in relation to its parent directory.

Examples

Create a symbolic link to a file or directory:

ln -s {{/path/to/file_or_directory}} {{path/to/symlink}}

Overwrite an existing symbolic link to point to a different file:

ln -sf {{/path/to/new_file}} {{path/to/symlink}}

Create a hard link to a file:

ln {{/path/to/file}} {{path/to/hardlink}}

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.