ln
ln: make links between files.
Synopsis
ln [-sfnv] target [link]
ln [-sfnv] target… directory
Description
In the first form, ln makes a link named link to target. With no link, the link is made in the current directory with the target’s last name. If link is an existing directory, the link goes inside it, as in the second form.
In the second form, ln makes a link to each target inside directory, each named after its target’s last name.
Without -s, ln makes a hard link, which no filesystem in mcos supports: it always fails with “Operation not permitted”.
Options
Options must come before the first operand; they may be combined (-sf).
- -s
- Make symbolic links. The target is stored as given; a relative target is followed from the link’s directory, not from where ln ran.
- -f
- Remove an existing file or link of the link’s name first.
- -n
- Treat a last operand that is a symbolic link to a directory as a name, not as a directory to put links in (with -f, it is replaced).
- -v
- Print each link made, as link -> target, each name in single quotes.
Exit status
0 if every link was made; 1 if any failed, on a bad option, a missing operand, or several targets and a last operand that is not a directory.
Examples
ln -s /mnt/sata/1/notes notes
ln -sf ../lib/new.lua lib.lua
ln -s /bin/ls /bin/cat /tmp
See also
ls(1), rm(1), cp(1), mv(1)