commands

realpath — resolve an absolute canonical path

GNU realpath resolves path components and symbolic links. -e requires all components to exist. Canonicalization is not a security boundary because filesystem state can change. Examples assume a fresh chapter files lab.

Formal Syntax & Structure

linux syntaxlinux
realpath [OPTION]... FILE...

Parameters & Attributes

NameTypeDescription
-eoptionRequire all components to exist
FILEoperandPath to resolve

Return Value

text and exit status

GNU realpath prints a canonical absolute path; -e requires all components to exist. An unresolved required component yields nonzero status. A successful resolution is only a point-in-time observation.

Working Example

Example Snippetlinux
realpath -e notes/hello.txt
Linux Reference