readlink

Resolve and display the target of a symbolic link.

low risk

interactive breakdown — edit the command and press Explain
$ 
What it does

readlink prints the target of a symlink. The -f flag canonicalizes the entire path, resolving all nested symlinks and relative components — essential for finding the true absolute path of any file.

Common flags
FlagMeaning
-f --canonicalizeResolve all symlinks to absolute path
-e --canonicalize-existingCanonicalize, fail if path doesn't exist
-m --canonicalize-missingCanonicalize even if path doesn't exist
Examples
readlink /usr/bin/python3Show where python3 symlink points · explain & risk-check →
readlink -f /etc/nginx/sites-enabled/appResolve full canonical path · explain & risk-check →
readlink -f $0Get absolute path of current script · explain & risk-check →
Pro tip

Use `readlink -f $0` at the top of shell scripts to get the script's actual directory regardless of how it was invoked — essential for portable scripts.

Related
ln which find
Open the full explainer →More in Files & Archives

Reference text is hand-written and may be incomplete — check man readlink for your version. Test destructive commands on a non-production system first.