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 small file that points to another file or directory by path. Create one with ln -s TARGET LINKNAME.

The concept

A symlink stores a path. Opening it transparently opens the target. If the target is moved or deleted the link becomes 'dangling' and fails.

A hard link, in contrast, is another name for the same file data (same inode), cannot cross filesystems and cannot point to directories.

The link points at a path

→ points tocurrentsymlinkreleases/42real folder
Open the link → the system follows the path.

Practical examples

Create and inspect

ln -s /var/www/releases/42 /var/www/current
ls -l /var/www/current
# current -> /var/www/releases/42

Atomic deploy switch

ln -sfn /var/www/releases/43 /var/www/current

Remove a link (not the target)

rm /var/www/current

Find broken links

find . -xtype l

Common mistakes

  • Swapping the argument order: it is ln -s TARGET LINK.
  • Using relative targets that break when the link is moved.
  • Using rm -r link/ with a trailing slash and deleting the target's contents.

Key takeaways

  • ln -s target link.
  • Links hold paths; deleting the target breaks them.
  • ln -sfn swaps a link atomically.

FAQ

Symlink vs hard link?

Symlinks point to a path and can cross filesystems; hard links share an inode.

Do symlinks work on Windows?

Yes with mklink, though it often requires admin or developer mode.

More Linux articles