READLINK(1) General Commands Manual READLINK(1)

readlinkprint content of a symbolic link

readlink [-f|-e] [-n|-z] path

Note: For canonicalization of a path, use the realpath(1) utility instead for better portability.

The readlink utility reads the symbolic link of each path and prints it.

If path is not a symbolic link, readlink errors out.

Canonicalize path with following every symlink, all but the last path component are required to exists.
Canonicalize path with following every symlink, all path component must exists.
Do not print a trailing separator.
Use NULL byte as separator instead of newlines.

The readlink utility exits 0 on success, and >0 if an error occurs.

Assign //example.org/ to foobar and read it:

  $ ln -s //example.org/ foobar
  $ readlink foobar
  //example.org/

ln(1), readlink(3)

readlink should be compliant with the IEEE Std 1003.1-2024 (“POSIX.1”) specification.

The options -f, -e and -z and support for multiple path arguments are extensions present for compatibility with existing software.

Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>

2024-04-24 Linux 6.6.67-gentoo-x86_64