--- layout: page category-page: fs category-title: FileSystem tags: link symbolic hard file shortcut author: Riccardo Antonio Vivanco title: ln --- The ln command is used to create a link of a file or directory. A link is used to create multiple copies of a file in different places without using more storage than that needed to store a single copy of the given file.
The copies are instead a link that points to the original file. If the original is deleted, the copies will point to a non-existant file and become pointless.
The name of the command stands for LiNk

There are 2 kinds of links: hard and symbolic.
In an hard link, the original is indistinguishable from the linked copy, and the changes made to the file are the same, regardless of whether the modified file is the original or the linked copy. Hard links are not used for directories. ln creates hard links by default
The symbolic link (symlink) instead contains the path to the original file and referencing the linked copy will make the referencer point to the original file instead.
ln [flags] [source1] [source2] ... [target_dir]
ln [flags] [source] [target]
link [source] [target]
The link command can be used instead of ln, but flags and multiple source files won't be supported.
If multiple sources are supplied, the last parameter of the command must be a directory inside which the links will be created.

Flags