Back to the command reference

realpath

FilesFundamentals In simulator In real Linux

Print the resolved absolute path

Name: realpath: the real path

You can practise it right away in the simulator, and use it in real Linux mode too.

Description

realpath prints the canonical absolute path of a file: relative paths become absolute, . and .. are removed and symbolic links are resolved.

Syntax

realpath [OPTION]... FILE...

Common options

-s / --strip / --no-symlinksDon't resolve symlinks
-e / --canonicalize-existingEvery part of the path must exist
-m / --canonicalize-missingWork out the path even if parts of it do not exist
--relative-to DIRPrint the path relative to DIR

Examples

  • $ realpath ../notes.txt

    Turn a relative path into an absolute one

    Explain

Related