man.lsPlain-English help for Unix commands

ln Make links between files

Creates a second name for a file. By default it makes a hard link. With -s it makes a symbolic link (symlink), a small pointer to another path. You use it to give a file or folder a shortcut at a second location without copying the data.

Synopsis

ln [OPTION]... TARGET LINK_NAME
ln [OPTION]... TARGET... DIRECTORY

Common options

Option or formWhat it does
-sMake a symbolic link instead of a hard link
-fIf the link name already exists, remove it first and then make the link
-iAsk before replacing an existing link name
-vVerbose: print each link as it is made
-nIf the link name is a symlink to a folder, treat it as a plain file instead of going into the folder. Use with -f to replace such a symlink
-hmacOS and BSD: same as -n
-PWhen hard linking a symlink, link to the symlink itself. -L, the macOS default, links to the file it points to

Examples

Make a symbolic link to a file
ln -s notes.txt notes-link.txt
Make a symbolic link to a folder
ln -s docs documentation
Make a hard link and print what was done
ln -v notes.txt notes-hard.txt
Link several files into a folder
ln -s ../notes.txt ../app.log docs/
Replace an existing symlink
ln -s notes.txt current && ln -sfn app.log current
Link a config file into place from a project folder
ln -s ~/projects/dotfiles/vimrc ~/.vimrc

Notes

See also

Last reviewed 2026-10-07.