Home

readlink

Readlink is a command-line utility in Unix-like operating systems used to display the target of a symbolic link or to resolve a path to its canonical form. It is commonly provided by the GNU coreutils package on Linux and is also available on BSD-derived systems, with similar behavior in some environments.

By default, readlink prints the value stored in a symbolic link, i.e., the immediate target that the

Many implementations offer options to resolve a full, absolute path by following all links and normalizing

Usage and portability: readlink is widely available but its options and exact semantics can vary between GNU

Exit status: The command typically returns a zero exit status on success and a non-zero status if

Examples: readlink /path/to/link; readlink -f /path/to/link (when supported).

link
points
to.
If
the
given
path
is
not
a
symbolic
link,
the
command
may
fail
with
an
error
on
many
implementations.
The
exact
output
depends
on
the
file
system
and
the
particular
implementation.
components
like
.
and
..
In
GNU
coreutils,
a
typical
option
for
this
behavior
is
-f,
which
canonicalizes
the
path
by
dereferencing
symlinks
along
the
way.
Other
variants
or
systems
may
provide
different
or
fewer
options,
and
some
BSD-derived
readlink
utilities
may
not
support
-f.
and
BSD
versions.
On
systems
that
lack
a
suitable
option
for
full
path
resolution,
tools
like
realpath
or
a
combination
of
readlink
and
additional
shell
processing
may
be
used
instead.
an
error
occurs
(for
example,
if
the
path
does
not
exist
or
is
not
a
symbolic
link).