Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

Symbolic Links

Direct answer

A symbolic (soft) link is a small file that contains a path to another file or directory (ln -s target link). It can cross filesystems and point to directories, but breaks if the target moves.

When to use this

Use it for version switching and shortcuts, or when a link points nowhere or to the wrong place.

First 30 seconds

1. ls -l <link> — target shown?

2. readlink -f <link> — final path; empty or missing → broken link.

3. Find broken links: find <dir> -xtype l.

4. Relative path wrong → recreate with ln -sfn <target> <link>.

5. Test access through the link.

Operational verification

link opened → kernel reads the stored path → resolves it (relative to the link's directory) → opens the target

Evidence · next step

For Filesystem → Symbolic Links, continue with the first unproven Topic check: Inspect link type and stored target without following it first. If that boundary is healthy, advance to the adjacent check: Resolve relative target from the symlink directory in the affected namespace. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Scope / prerequisiteUse it for version switching and shortcuts, or when a link points nowhere or to the wrong place.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

5 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

symlink directory entry/inode → stored target string → namespace-relative pathname resolution → target mount/dentry/inode → target authorization → consumer result

Healthy evidence: stored target resolves in the affected namespace to the intended object with valid authorization and the consumer succeeds.

Step 2 Verification and output interpretation Verify boundary

Existing fast checks for this Topic. - Inspect link type and stored target without following it first.

  • Resolve relative target from the symlink directory in the affected namespace.
  • Trace all link/path components and mount crossings for loops, dangling targets or unexpected redirects.
  • Verify target ownership/permissions and the consumer’s final operation.

Verification chain. symlink directory entry/inode → stored target string → namespace-relative pathname resolution → target mount/dentry/inode → target authorization → consumer result

Step 3 Commands Verify boundary
ln -s /opt/app/current /usr/local/bin/app
readlink -f /usr/local/bin/app
find / -xtype l 2>/dev/null   # broken links
Step 4 Failure modes and next checks Narrow the fault

Suspicious evidence: relative targets are resolved from the wrong base, link existence is mistaken for target existence, or long chains redirect to an unexpected mount/object.

Step 5 Common mistakes Narrow the fault
  • Relative symlinks breaking after moves.
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points

Relative targets are resolved from the link's directory, not your current directory. ls -l shows the target; readlink -f the final resolved path. Permissions of the link itself do not matter — the target's do.

Key checks
  • readlink -f <link> — resolved target
  • find <dir> -xtype l — broken symbolic links
  • ls -ld <path> — owner, permissions and type
  • stat <path> — inode, links, size and timestamps
  • df -h <path> — filesystem and free space
  • findmnt <path> — which mount the path is on
ReferenceWhat it is1 section · depth on demand

Core model

Inspect the symlink object without dereferencing, capture its stored target string, then resolve that target from the symlink’s directory and the same mount namespace as the consumer. Distinguish symlink metadata from target metadata and validate multi-link chains for loops or unexpected redirects.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

Symlink evidence shows a pathname reference, not target existence, target authorization or application success after resolution.

In depth

Symbolic links

A symbolic link is a small file whose content is a path name. The symlink(7) manual page sums it up: a symlink is a pointer to another name, not to an underlying object. That makes it flexible:

  • It can point to directories and across file systems.
  • Its target doesn't have to exist. A link to a missing target is dangling.
  • On Linux, the permissions of ordinary symlinks are always 0777 and can't be changed. Access is decided by the target.
  • A relative link may stop working if it's moved to another directory.

Which operations follow links (manual)

SituationFollows the link?
Symlinks in the directory part of a pathAlmost always
open, stat, cat, cp on the linkYes
lstat, readlink, unlink, rename, rm, mvNo; they act on the link itself
rm -r on a directory containing linksNever removes the targets
chown -hChanges the link, not the target
Recursive tools (find, cp -r, chmod -R)Not by default; -L, -H and -P control it

Relative and absolute targets

TargetGood for
Absolute (/opt/app/releases/42)Links that are never moved
Relative (releases/42)Trees that are copied or mounted elsewhere, such as chroots and containers

Typical uses

UseExample
Version switching/opt/app/current -> releases/42
Enabling configuration/etc/nginx/sites-enabled/site -> ../sites-available/site
Compatibility paths/bin -> usr/bin
systemd enablement and masking*.wants/ links, links to /dev/null
host$ ln -sfn releases/42 /opt/app/current
host$ ls -l /opt/app/current
lrwxrwxrwx 1 deploy deploy 11 Nov 28 11:40 /opt/app/current -> releases/42
host$ readlink -f /opt/app/current
/opt/app/releases/42
host$ find /etc -xtype l
/etc/nginx/sites-enabled/old-site
host$ ln -sfn releases/43 /opt/app/current.new && mv -T /opt/app/current.new /opt/app/current
host$ namei -l /opt/app/current/bin/start

Atomic switch

ln -sfn alone removes the old link and creates a new one, which leaves a short moment without a link. Creating the new link under a temporary name and renaming it with mv -T replaces the link in one step. That's the usual way to switch releases without a gap. find -xtype l lists dangling links.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

Symbolic Links is part of Filesystem → Symbolic Links. Symbolic Links are separate filesystem objects whose content is a pathname reference to another path; they can cross filesystem boundaries and can be absolute or relative, but resolution can fail when the target moves, disappears or is interpreted from a different namespace/location.

Topic-specific state model. Symbolic Links are separate filesystem objects whose content is a pathname reference to another path; they can cross filesystem boundaries and can be absolute or relative, but resolution can fail when the target moves, disappears or is interpreted from a different namespace/location.

Interpretation rule. - Symlink ≠ hard link; it has its own inode and stores a path reference.

  • Symlink can exist while target is missing, producing a dangling link.
  • Relative symlink target is resolved relative to the link’s containing directory, not the caller’s current directory.
  • Access to symlink pathname ≠ authorization to the final target path.

Quick reference

Symbolic links store a path to another file or directory; they can cross filesystems and point to things that do not exist (dangling links).

ln -s /opt/app/releases/1.4.2 /opt/app/current
ln -sfn /opt/app/releases/1.4.3 /opt/app/current     # atomic switch for deployments
readlink -f /opt/app/current
find /etc -xtype l                                     # dangling symlinks

Security: fs.protected_symlinks=1 (default) stops following symlinks in world-writable sticky directories owned by others, preventing classic /tmp symlink attacks.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. Symlink evidence shows a pathname reference, not target existence, target authorization or application success after resolution.

ReferenceConfiguration & state1 section · depth on demand

Configuration, persistence and lifecycle

Distribution/platform context. Symbolic Links owns path-reference semantics. Permissions, mount namespaces and file-management commands belong to their dedicated branches.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in Filesystem → Symbolic Links. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/index.html · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
linux symbolic linkssymlink linuxsoft link linuxdangling symlink
Embedded reference data

Quick lookup tables

Symbolic Links operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for Symbolic Links.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateSymbolic Links are separate filesystem objects whose content is a pathname reference to another path; they can cross filesystem boundaries and can be absolute or relative, but resolution can fail when the target moves, disappears or is interpreted from a different namespace/location.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin process/container mount namespace → resolve the exact path from / and record every mount crossing → identify final dentry + filesystem/device + inode + file type → capture ownership/mode/ACL and capacity where relevant → map pseudo/device/runtime objects to the live kernel/process endpoint → verify the original consumer read/write/execute/service result.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainsymlink directory entry/inode → stored target string → namespace-relative pathname resolution → target mount/dentry/inode → target authorization → consumer resultTrace requested/configured state through effective state to the observed workload result.
Failure boundarySymlink evidence proves a pathname reference, not target existence, target authorization or application success after resolution.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated namespace, path and object evidence can establish this Linux Filesystem proof path: symlink directory entry/inode → stored target string → namespace-relative pathname resolution → target mount/dentry/inode → target authorization → consumer resultUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove behavior outside the captured namespace, mount, inode/object, authorization, backing-resource or consumer scope. Symlink evidence proves a pathname reference, not target existence, target authorization or application success after resolution.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven boundary: preserve the same process mount namespace, resolve the path and mount crossings, identify the exact object/inode or live pseudo/device endpoint, inspect effective access/capacity, then repeat the original consumer operation before changing unrelated filesystem state.Continue to the next unresolved boundary while preserving the original test condition.

Symbolic Links · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundarySymbolic Links
Topic pathFilesystem → Symbolic Links
Runtime stateSymbolic Links are separate filesystem objects whose content is a pathname reference to another path; they can cross filesystem boundaries and can be absolute or relative, but resolution can fail when the target moves, disappears or is interpreted from a different namespace/location.
Fast checks- Inspect link type and stored target without following it first. - Resolve relative target from the symlink directory in the affected namespace. - Trace all link/path components and mount crossings for loops, dangling targets or unexpected redirects. - Verify target ownership/permissions and the consumer’s final operation.
Verification chainsymlink directory entry/inode → stored target string → namespace-relative pathname resolution → target mount/dentry/inode → target authorization → consumer result Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundarySymlink evidence proves a pathname reference, not target existence, target authorization or application success after resolution. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?