Forrest logo
tool overview
On this page you find all important commands for the CLI tool realpath. If the command you are looking for is missing please ask our AI.

realpath

Realpath is a command line tool that is used to resolve the absolute canonical path of a given file or directory in the system. It is primarily used to resolve symbolic links and resolve the true path of a file or directory in cases where there might be multiple levels of symbolic links involved.

The realpath command takes a path as its argument and returns the full and resolved path of the file or directory. It is useful for obtaining the exact and unambiguous location of a file or directory in the file system.

Realpath also resolves any relative paths to their absolute equivalents, making it handy for scripting and automation tasks where the full path is required.

In cases where the specified path does not exist, realpath will return an error message indicating the absence of the file or directory.

In addition, realpath can handle multiple paths as input and output the resolved path for each input path, making it versatile for batch processing.

Realpath is available on various Unix-like operating systems, such as Linux, macOS, and BSD. It is a standard command and usually comes pre-installed with the operating system.

One of the key advantages of realpath is its ability to resolve complex and nested symbolic links, ensuring the path returned is the actual physical location of the file or directory.

By default, realpath also follows symbolic links and resolves the true path. However, there are options available to disable this behavior and interpret symbolic links as ordinary files or directories.

Realpath is commonly used in shell scripting, file management, and system administration tasks to obtain accurate path information and ensure the correct handling of files and directories.

List of commands for realpath:

  • realpath:tldr:23914 realpath: Require all path components to exist.
    $ realpath --canonicalize-existing ${filename_or_directory}
    try on your machine
    explain this command
  • realpath:tldr:7d551 realpath: Suppress error messages.
    $ realpath --quiet ${filename_or_directory}
    try on your machine
    explain this command
  • realpath:tldr:93908 realpath: Disable symlink expansion.
    $ realpath --no-symlinks ${filename_or_directory}
    try on your machine
    explain this command
  • realpath:tldr:ea036 realpath: Resolve ".." components before symlinks.
    $ realpath --logical ${filename_or_directory}
    try on your machine
    explain this command
tool overview