Create and Manage Symbolic Links on Linux
A symbolic link, or symlink, is a special filesystem entry that stores a path to another file or directory. Symlinks are useful for shortcuts, shared configuration, version switching, and keeping one canonical copy of data.
Create a Symlink
ln -s TARGET LINK_NAMELink to a file:
ln -s /home/user/documents/report.txt /home/user/Desktop/report_link.txtLink to a directory:
ln -s /var/www/html /home/user/webrootInspect a Symlink
ls -l /home/user/webroot
readlink /home/user/webrootTo resolve the full target path where supported:
readlink -f /home/user/webrootRemove a Symlink
rm /home/user/webrootRemoving the symlink does not remove the target. Be especially careful with trailing slashes and commands that follow directory symlinks; always verify the path before destructive operations.
Replace a Symlink Target
You can remove and recreate it, or use ln options appropriate for your system. A simple explicit workflow is:
rm current
ln -s /opt/myapp/releases/2026-09 currentThis pattern is commonly used to point a stable path at a selected release.
Symlink vs. Hard Link
A symlink stores a pathname and can cross filesystems, but becomes broken if its target path disappears. A hard link refers to the same inode as another directory entry, cannot normally cross filesystems, and is generally used for regular files rather than directories.
Conclusion
Symlinks are a simple way to create alternate paths without copying data. Use ln -s to create them, readlink or ls -l to inspect them, and rm to remove only the link.