# ln¶

ln creates a link.

A filesystem distinguishes between file names (stored in the table of the directory that owns it) and the content of the file (inode).

A link defines a relationship between a filename and an inode.

The ln command adds a link between a file inode and a new name.

ln source target


source is a file name, target is a file name that will have the same inode than target.

The number of links to a file can be obtained with the command ls (ls -la).

cp options meaning
-f remove existing destination file
-s creation of a symbolic link

A symbolic link is a link to the name of the file and not to the inode.

touch a b
ls -l
ln a c
ls -l
ln -s b d
ls -l
ln a e
ls -l