# Link (Unix)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Link_(Unix)
> Markdown URL: https://mediated.wiki/source/Link_(Unix).md
> Source: https://en.wikipedia.org/wiki/Link_(Unix)
> Source revision: 1297068400
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Unix command}}
{{lowercase}}
{{Infobox software
| name                   = link
| logo                   = 
| screenshot             = 
| screenshot size        = 
| caption                = 
| author                 = 
| developer              = 
| released               = 
| latest release version = 
| latest release date    = 
| operating system       = [Unix](/source/Unix) and [Unix-like](/source/Unix-like)
| platform               = [Cross-platform](/source/Cross-platform)
| genre                  = [Command](/source/Command_(computing))
| license                = 
| website                = 
}}
The '''link''' [utility](/source/utility) is a [Unix](/source/Unix) [command line](/source/command_line) program that creates a [hard link](/source/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](/source/ln_(Unix))'' command is more commonly used as it provides more features: it can create both hard links and [symbolic link](/source/symbolic_link)s, and has [error](/source/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](/source/Single_UNIX_Specification) (SUS), specified in the ''Shell and Utilities'' volume of the [IEEE 1003.1](/source/IEEE_1003.1)-2001 standard.

== See also ==
* [List of Unix commands](/source/List_of_Unix_commands)
* [Unlink (Unix)](/source/Unlink_(Unix))

== External links ==
* [http://www.opengroup.org/onlinepubs/000095399/idx/utilities.html IEEE Std 1003.1-2004 Shell & Utilities volume]—list of [SUS](/source/Single_UNIX_Specification) utilities.
* [https://www.gnu.org/software/coreutils/manual/coreutils.html#link-invocation GNU Coreutils '''link'''] documentation.

{{Unix commands}}
{{Core Utilities commands}}

Category:Unix SUS2008 utilities

{{Unix-stub}}

---
Adapted from the Wikipedia article [Link (Unix)](https://en.wikipedia.org/wiki/Link_(Unix)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Link_(Unix)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
