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.


  • -F: overwrites the [target] file / directory if it already exists.
  • -h: if the [source] is a symlink, do not follow it
  • -f: if the [target] already exists, unlink it before replacing it.
  • -i: ask for confirmation in case the [target] file already exists.
  • -s: creates a symbolic instead of hard link