Frequently Asked Question

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

A hard link is a second directory entry pointing to the same inode on the same filesystem. Both names are equally real, there's no notion of "the original", and the inode's reference count tracks how many links exist. The file's data goes away only when the last link is removed. Because the link is to an inode number, hard links cannot cross filesystem boundaries, and Linux forbids hard links to directories (it would let you construct cycles that confuse every directory-walking tool).

A symbolic link (symlink, soft link) is a small file whose contents are a path string. When you open it, the kernel reads the string and tries to open whatever it names, which may be on another filesystem, may not exist yet, or may change later. Symlinks can point to directories, can dangle (point to nothing), and behave very differently in ls -l (showing the target with ->) and stat. The ln command creates hard links by default; ln -s target name creates a symlink.

Video

Further reading and video