Skip to content
Calcrivo

Symbolic Link Path Calculator

Resolve relative and absolute symbolic link target paths across directory levels.

Inputs

Resolved Absolute Path

/var/releases/v2.3.0

Loop / Depth Status

Within safe resolution depth.

Target Is Absolute?

false

Symlink's Containing Directory

/var/www

Step by step

  1. Values used

    Symlink Location (absolute path) = /var/www/current; Symlink Target (as stored, may be relative) = ../releases/v2.3.0; Number of Chained Symlinks (if target is itself a symlink) = 1

  2. Relative target resolution

    resolved_path = normalize(dirname(symlink_path) + '/' + target)

  3. Resolved Absolute Path

    = /var/releases/v2.3.0

  4. Loop / Depth Status

    = Within safe resolution depth.

  5. Target Is Absolute?

    = No

  6. Symlink's Containing Directory

    = /var/www

How it works

A relative symlink target is resolved relative to the directory containing the symlink itself, not the current working directory of whoever follows it — a common source of broken links when files are moved. This calculator normalizes '..' and '.' segments to compute the final absolute path, and flags when a chain of symlinks would exceed Linux's hard-coded maximum resolution depth of 40 (MAXSYMLINKS), beyond which the kernel returns ELOOP ('too many levels of symbolic links'), which is also how circular symlink references are ultimately caught.

Formula

Relative target resolution

resolved_path = normalize(dirname(symlink_path) + '/' + target)

P_link
absolute path of the symlink
T
stored target path

Frequently Asked Questions

Relative to what is a relative symlink target resolved?

Relative to the directory containing the symlink itself — not the shell's current working directory, and not the target of any earlier symlink in a chain. This is why moving a symlink (without moving its target) or moving the symlink's containing directory can silently break it.

What is the maximum symlink chain depth on Linux?

The kernel defines MAXSYMLINKS as 40. Resolving a path through more than 40 chained symlinks returns ELOOP ('too many levels of symbolic links'), which is also the mechanism that catches genuinely circular symlinks (A → B → A).

How can I see where a symlink actually points?

Use `readlink -f <path>` to fully resolve a symlink (including chains) to its final absolute, canonical target, or plain `readlink <path>` to see just the immediate, unresolved target as stored.