Skip to main content

Display the resolved absolute path for a file or directory.

# To display the absolute path for a file or directory:
realpath <path/to/file_or_directory>

# To require all path components to exist:
realpath --canonicalize-existing <path/to/file_or_directory>

# To resolve ".." components before symlinks:
realpath --logical <path/to/file_or_directory>

# To disable symlink expansion:
realpath --no-symlinks <path/to/file_or_directory>

# To suppress error messages:
realpath --quiet <path/to/file_or_directory>