symbolic-link · shipping · also symlink, soft link

Symbolic link

A symbolic link is a filesystem object that stores a pathname to be interpreted when an operation follows the link.

Related Observatory article: Symbolic link on hesela.com

An ordinary symlink names a path rather than holding its referent's inode alive. Its stored target may be absolute or relative; a relative target starts from the directory containing the link, not the caller's working directory. The target need not exist; a dangling link can still be inspected with lstat() and readlink(), while stat() follows the link. [4] [5] [1]

On Linux, rename() and unlink() act on a final-component symlink itself. Renaming a distinct regular file over the link replaces the link entry, not the referent's contents. Moving a relative symlink to another directory may change its destination. [3] [2]

Procfs magic links, such as /proc/pid/fd entries, are different. They can refer directly to a kernel file handle rather than expanding an ordinary stored path. [2]

Preserving stored link text during backup does not by itself preserve the resolved destination after relocation. Whether a restore should retain the link object or copy its referent is part of the recovery policy, not a property established by equal link text. [2]

At the C API, readlink() neither NUL-terminates nor signals truncation with an error. A capacity-sized return needs a larger bounded retry or an incomplete-capture error; lstat() sizing can become stale. Linux readlinkat(fd, "", ...) on an O_PATH | O_NOFOLLOW descriptor reads that held link, even after pathname replacement, but does not bind its referent. Language wrappers may allocate buffers internally. [5]

Relations

related
Path resolution, Hard link, Inode, Atomic rename, Unlink, Open file description

Advantages

  • Can refer to directories and cross filesystem boundaries.

Limitations

  • Does not provide an independent copy of the target's data.
  • Stored target text does not guarantee that a later lookup reaches the same object.

Citations

  1. Linux man-pages: rename(2), symbolic-link operands (accessed 2026-11-03)
  2. Linux man-pages: stat(2), link versus referent metadata (accessed 2026-11-03)
Sources & caveats
  • Ordinary symlink semantics are described separately from Linux procfs magic links; no crash-survival guarantee follows from these namespace rules.

JSON: /data/terms/symbolic-link.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Symbolic link. Hesela. 2026-11-03. https://hesela.dev/terms/symbolic-link/