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

Updated October 2026 · How we answer

Short answerA hard link is another name for the same file data (same inode); a soft link (symlink) is a separate file that points to a path.

Hard links: same inode, same data

A hard link creates an additional directory entry that points to the same inode as the original file. Both names refer to identical data; deleting one does not remove the data until all hard links are gone. Hard links cannot cross filesystems and usually cannot link to directories (except . and ..).

You create a hard link with ln source target. The link count (shown by ls -l) increases by one. Hard links are useful for deduplication or backup schemes like rsync --link-dest.

Soft links: separate file pointing to a path

A soft link (symbolic link) is a special file that contains a path to another file or directory. It has its own inode. If the target is deleted, the symlink becomes a dangling link and operations fail. Soft links can cross filesystems and can point to directories.

Create one with ln -s target linkname. ls -l shows the link with an arrow (->). Symlinks are common for version management (e.g., /usr/bin/python -> python3.9) and for config files.

  • Hard link: same inode, same data, cannot cross filesystems
  • Soft link: separate inode, points to path, can cross filesystems
  • Hard link: deleting original leaves data accessible via other links
  • Soft link: deleting original breaks the link
  • Use ln for hard, ln -s for soft

Common mistakes

  • Thinking hard links save space: they don't duplicate data, but they also don't reduce space beyond the original file.
  • Assuming symlinks are always followed: some commands (like rm or chmod) act on the link itself unless you use -L or dereference options.
  • Trying to hard link directories: most filesystems disallow this to prevent cycles.
From our shopsTitan Case: Premium MagSafe iPhone cases with a precision fit.