www.LinuxHowtos.org





LN

Section: User Commands (1)
Updated: February 2026
Index Return to Main Contents
 

NAME

ln - make links between files  

SYNOPSIS

ln [,OPTION/]... [,-T/] ,TARGET LINK_NAME/
ln [,OPTION/]... ,TARGET/
ln [,OPTION/]... ,TARGET/... ,DIRECTORY/
ln [,OPTION/]... ,-t DIRECTORY TARGET/...  

DESCRIPTION

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.

Mandatory arguments to long options are mandatory for short options too.

X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-backup'--backup[=CONTROL]X'tty: link'
make a backup of each existing destination file
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-b'-bX'tty: link'
like --backup but does not accept an argument
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-d'-d, -F, --directoryX'tty: link'
allow the superuser to attempt to hard link directories, if supported by the system
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-f'-f, --forceX'tty: link'
remove existing destination files
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-i'-i, --interactiveX'tty: link'
prompt whether to remove destinations
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-L'-L, --logicalX'tty: link'
dereference TARGETs that are symbolic links
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-n'-n, --no-dereferenceX'tty: link'
treat LINK_NAME as a normal file if it is a symbolic link to a directory
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-P'-P, --physicalX'tty: link'
make hard links directly to symbolic links
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-r'-r, --relativeX'tty: link'
with -s, create links relative to link location
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-s'-s, --symbolicX'tty: link'
make symbolic links instead of hard links
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-S'-S, --suffix=,SUFFIXX'tty: link'/
override the usual backup suffix
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-t'-t, --target-directory=,DIRECTORYX'tty: link'/
specify the DIRECTORY in which to create the links
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-T'-T, --no-target-directoryX'tty: link'
treat LINK_NAME as a normal file always
X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#l-v'-v, --verboseX'tty: link'
print name of each linked file
X'tty: link https://www.gnu.org/software/coreutils/ln#l-help'--helpX'tty: link'
display this help and exit
X'tty: link https://www.gnu.org/software/coreutils/ln#l-version'--versionX'tty: link'
output version information and exit

The backup suffix is '~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the --backup option or through the VERSION_CONTROL environment variable. Here are the values:

none, off
never make backups (even if --backup is given)
numbered, t
make numbered backups
existing, nil
numbered if numbered backups exist, simple otherwise
simple, never
always make simple backups

Using -s ignores -L and -P. Otherwise, the last option specified controls behavior when a TARGET is a symbolic link, defaulting to -P.  

AUTHOR

Written by Mike Parker and David MacKenzie.  

REPORTING BUGS

Report bugs to: bug-coreutils@gnu.org


Report Gentoo bugs to: https://bugs.gentoo.org/
GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
General help using GNU software: <https://www.gnu.org/gethelp/>
Report any translation bugs to <https://translationproject.org/team/>  

SEE ALSO

link(2), symlink(2)


Full documentation <https://www.gnu.org/software/coreutils/ln>
or available locally via: info aq(coreutils) ln invocationaq


Packaged by Gentoo (9.10 (p0))
Copyright © 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.


 

Index

NAME
SYNOPSIS
DESCRIPTION
AUTHOR
REPORTING BUGS
SEE ALSO