Jump to content

link (Unix)

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Noahspurrier (talk | contribs) at 03:11, 18 November 2008 (This isn't beautiful, but at least it's not wrong, as the original article was. GNU coreutils does have '''link''' command: http://www.gnu.org/software/coreutils/manual/coreutils.html#link-invocation). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.


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 if the link was created or not (0 if successful, >0 if an error occurred). It can be run only by privileged users in the case where the existing directory entry refers to a directory.

The ln command is more commonly-used as it provides more feature; can create both hard links and symbolic links; and has error checking.

Synopsis

   link file1 file2
file1
The pathname of an existing file.
file2
The pathname of the new directory entry to be created.

Note that file1 must specify an existing file, and file2 must specify a nonexistent entry in an existing directory.

Standards

The link command is part of the Single UNIX Specification, specified in the Shell and Utilities volume of IEEE Std 1003.1-2001.

See also