Symbolic Link
Also known as: symlink, soft link, symbolic link
A symbolic link (symlink) is a small special file that stores a path to another file or directory. It resolves to its target at access time, can cross filesystems, and becomes a dangling link if the target is removed.
- A symbolic link stores a path to its target and resolves at access time, so it can cross filesystems.
- If the target is deleted or moved, the symlink dangles and resolves to nothing.
- Unlike a hard link, a symlink is a separate object with its own inode, not another name for the target's data.
How a symbolic link works
A symbolic link, also called a soft link, is a tiny file whose contents are a path string rather than data. When a program opens the link, the operating system reads that path and redirects to the target. Because the link only stores a path, the target can live on a different filesystem or volume, and the link can even point to a name that does not exist yet.
You create one with `ln -s target linkname`. If the target is later deleted or moved, the link still exists but resolves to nothing, this is a dangling or broken symlink. Tools that follow links must decide whether to operate on the link itself or the file it points to (for example `rm` removes the link, while editing through it changes the target).
Symlink vs hard link
A hard link is a second directory entry for the same inode, so it shares the file's identity and data and cannot dangle or cross filesystems. A symbolic link is an independent object that merely names a path, so it can span filesystems and can break.
Symlinks are widely used for shared libraries, configuration overlays, and convenient shortcuts. On Apple platforms note that user-facing Finder aliases and app bookmarks are a separate, higher-level mechanism, while POSIX symlinks still exist underneath on APFS and macOS.
Why a cleaner must not double-count links
Following symlinks blindly during a scan can cause a cleaner to count the same data twice, walk into a loop, or wander outside the directory it was told to clean. A symlink that points back up its own tree can even create an infinite traversal.
A reliable tool like Cleanor recognizes symlinks, attributes storage to the real target only once, and avoids deleting or re-counting through a link, so reported space stays accurate and traversal stays safe.