The link utility is a
Unix
Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and ot ...
command line
A command-line interpreter or command-line processor uses a command-line interface (CLI) to receive commands from a user in the form of lines of text. This provides a means of setting parameters for the environment, invoking executables and pro ...
program that creates a
hard link
In computing, a hard link is a directory entry (in a directory-based file system) that associates a name with a file. Thus, each file must have at least one hard link. Creating additional hard links for a file makes the contents of that file acc ...
from an existing directory entry to a new directory entry. It does no more than call the ''link()'' system function. It does not perform error checking before attempting to create the link. It returns an exit status that indicates whether the link was created (0 if successful, -1 if an error occurred). Creating a link to a directory entry that is itself a directory requires elevated privileges.
The ''
ln'' command is more commonly used as it provides more features: it can create both hard links and
symbolic link
In computing, a symbolic link (also symlink or soft link) is a file whose purpose is to point to a file or directory (called the "target") by specifying a path thereto.
Symbolic links are supported by POSIX and by most Unix-like operating system ...
s, and has error checking.
Synopsis
link (-s) source target
;source: The pathname of an existing folder or file.
;target: The name of the link to be created.
Note that source must specify an existing folder or file, and target must specify a non-existent entry in an existing directory.
Standards
The link command is part of the
Single UNIX Specification (SUS), specified in the ''Shell and Utilities'' volume of the
IEEE 1003.1-2001 standard.
See also
*
List of Unix commands
This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems.
List
See also
* List of G ...
*
Unlink (Unix)
In Unix-like operating systems, unlink is a system call and a command line utility to delete files. The program directly interfaces the system call, which removes the file name and (but not on GNU systems) directories like rm and rmdir. If the ...
External links
IEEE Std 1003.1-2004 Shell & Utilities volume€”list of
SUS utilities.
GNU Coreutils linkdocumentation.
Unix SUS2008 utilities
{{Unix-stub