ln
The ln command is a standard Unix command utility used to create a hard link or a symbolic link to an existing file. The use of a hard link allows multiple filenames to be associated with the same file since a hard link points to the inode of a given file, the data of which is stored on disk. On the other hand, symbolic links are special files that refer to other files by name.[1]
- GNU Coreutils [EN] @ Fedora Package
- GNU Coreutils [EN] @ Homebrew Formula
Documentation
- ln [EN] @ GNU Coreutils Manual
- man 1 'ln' [EN]
Syntax
ln [PARAMETER ...] TARGET [LINK]
Parameters
- -f, --force
- Remove existing destination files.
- -r, --relative
- Make symbolic links relative to the link location.
- -s, --symbolic
- Make symbolic links instead of hard links.
- -t DIRECTORY, --target-directory=DIRECTORY
- Specify the destination DIRECTORY.
- -T, --no-target-directory
- Do not treat the last operand specially when it is a directory or a symbolic link to a directory.
Examples
- Link all Shell files to ~/bin
find "${HOME}/dev" -type 'f' -iname '*.sh' \
-exec ln --symbolic --force --target-directory="${HOME}/bin" '{}' ';'