A link is a second name for a file — and understanding what that means is one inode's worth of knowledge that makes the whole Linux filesystem click. ln creates these names, in two flavours that behave very differently.

A hard link and a symbolic link
$ ln notes.txt notes-hard.txt
$ ln -s notes.txt notes-soft.txt
$ ls -li notes*
1234 -rw-r--r-- 2 ana ana 512 Oct 21 notes.txt
1234 -rw-r--r-- 2 ana ana 512 Oct 21 notes-hard.txt
1237 lrwxr-xr-x 1 ana ana   9 Oct 21 notes-soft.txt -> notes.txt

The -i flag shows inode numbers. notes.txt and its hard link share inode 1234 — they are two directory entries for the same data, indistinguishable in seniority. The symlink is inode 1237, a separate small file whose content is a path.

What each one can do #

PropertyHard linkSymlink
Cross filesystemsNoYes
Link to a directoryNo (usually)Yes
Survives target deletionYesNo — goes dangling
Shows the target pathNoYes (ls -l)
SizeThe file'sThe path's length

The "survives deletion" row is the philosophical difference: a hard link keeps the data alive because the data's reference count is still positive; a symlink is only ever a pointer, and a dangling one at that.

Everyday use #

Symlinks do the daily work — version-switching without repaths:

Point "current" at the newest release
$ ln -sfn releases/v1.4 current

-sfn refreshes an existing link rather than nesting inside it. Dotfiles managed from a repository are the same trick: one symlink per file into ~.

Hard links earn their keep in backups — tools like rsync's --link-dest and every snapshot system build trees of hard links so unchanged files cost zero extra space:

A space-free duplicate tree, when unchanged
$ cp -al current/ snapshot-2026-10-21/

See stat, file, and which for inspecting what links point at, and df and du for why link trees keep snapshots cheap. More in the terminal notes.