Frequently Asked Question

What is the difference between a hard link and a symbolic link?

A hard link is a second directory entry pointing at the same inode. The two names are equal partners: neither is the "original", both refer to the same data on disk, and the file is only freed when the link count drops to zero. Because hard links are raw inode references, they cannot cross filesystem boundaries (each filesystem has its own inode table) and cannot point at directories (which would let you build loops that confuse find and friends). You make one with ln target linkname.

A symbolic link (or symlink) is a small file whose contents are the path of another file. When any program opens the symlink, the kernel transparently follows it to the target. Symlinks can cross filesystems, can point at directories, and can even point at things that do not exist yet (a "dangling" symlink). They are also visible as a distinct file type in ls -l, the leading l and the -> arrow give them away. Make one with ln -s target linkname; follow one fully with readlink -f linkname.

Video

Further reading and video