Jump to content

link (Unix)

From Wikipedia, the free encyclopedia

This is the current revision of this page, as edited by Janhrach (talk | contribs) at 09:00, 8 August 2022 (Added a short description). The present address (URL) is a permanent link to this version.

(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
link
Operating systemUnix and Unix-like
PlatformCross-platform
TypeCommand

The link utility is a Unix command line program that creates a hard link 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 links, and has error checking.

Synopsis

[edit]

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

[edit]

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

[edit]
[edit]