Forrest logo
back to the realpath tool

realpath:tldr:23914

realpath: Require all path components to exist.
$ realpath --canonicalize-existing ${filename_or_directory}
try on your machine

The realpath command is used to resolve the absolute path of a file or directory. It returns the canonicalized absolute pathname of the given file or directory name.

In the provided command, --canonicalize-existing is an option used with realpath to only canonicalize the existing files or directories. This means that if a given path is a symbolic link, the canonicalized path returned will follow that link and resolve to the actual file or directory it points to.

${filename_or_directory} is a placeholder representing the name or path of the file/directory you want to get the canonicalized path for. You should replace it with the actual file or directory name or path you want to resolve.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the realpath tool