What Is a Symbolic Link (Symlink) in Linux and How to Create One

A symlink is a pointer file referencing another file or directory by path. Learn how to create one with ln -s and how it differs from a hard link.

Published September 21, 2026

A symbolic link (symlink) is a special file that points to another file or directory by path, similar to a shortcut. Accessing the symlink transparently redirects to the target it points to.

Common causes

  • Symlinks are used to reference a file from multiple locations without duplicating it, or to keep a stable path (like /usr/bin/python) pointing at a versioned target that changes over time (python3.11)

How to fix it

  • Create a symlink with ln -s /path/to/target /path/to/linkname
  • Use readlink -f linkname to resolve exactly what a symlink actually points to, especially useful for chains of symlinks
  • Remember that deleting a symlink (rm linkname) never deletes the target file — only the pointer itself is removed

Example

ln -s /var/www/releases/v2 /var/www/current
# /var/www/current now transparently points to the v2 release

FAQ

What's the difference between a symlink and a hard link?

A symlink is a separate file containing a path reference and breaks if the target is moved or deleted. A hard link is a second directory entry pointing directly to the same underlying data on disk, and keeps working even if the original name is removed.

More Linux articles