readlink

v0.0.26
readlink [OPTION]... [FILE]...

Print value of a symbolic link or canonical file name.

Options

--canonicalize, -f

canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist

--canonicalize-existing, -e

canonicalize by following every symlink in every component of the given name recursively, all components must exist

--canonicalize-missing, -m

canonicalize by following every symlink in every component of the given name recursively, without requirements on components existence

--no-newline, -n

do not output the trailing delimiter

--quiet, -q

suppress most error messages

--silent, -s

suppress most error messages

--verbose, -v

report error message

--zero, -z

separate output with NUL rather than newline

Examples

Get the actual file to which the symlink points:

readlink {{path/to/file}}

Get the absolute path to a file:

readlink -f {{path/to/file}}

The examples are provided by the tldr-pages project under the CC BY 4.0 License.

Please note that, as uutils is a work in progress, some examples might fail.