realpath

v0.0.28
realpath [OPTION]... FILE...

Print the resolved path

Options

--quiet, -q

Do not print warnings for invalid paths

--strip, --no-symlinks, -s

Only strip '.' and '..' components, but don't resolve symbolic links

--zero, -z

Separate output filenames with \0 rather than newline

--logical, -L

resolve '..' components before symlinks

--physical, -P

resolve symlinks as encountered (default)

--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

--relative-to=<DIR>

print the resolved path relative to DIR

--relative-base=<DIR>

print absolute paths unless paths below DIR

Examples

Display the absolute path for a file or directory:

realpath {{path/to/file_or_directory}}

Require all path components to exist:

realpath --canonicalize-existing {{path/to/file_or_directory}}

Resolve ".." components before symlinks:

realpath --logical {{path/to/file_or_directory}}

Disable symlink expansion:

realpath --no-symlinks {{path/to/file_or_directory}}

Suppress error messages:

realpath --quiet {{path/to/file_or_directory}}

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.