realpath

Display the resolved absolute path for a file or directory. More information: <https://www.gnu.org/software/coreutils/realpath>.

Install

All systems
curl cmd.cat/realpath.sh
Debian Debian
apt-get install realpath
Ubuntu
apt-get install realpath
Alpine
apk add coreutils
Arch Arch Linux
pacman -S coreutils
image/svg+xml Kali Linux
apt-get install coreutils
CentOS
yum install coreutils
Fedora
dnf install coreutils
Windows (WSL2)
sudo apt-get update sudo apt-get install realpath
OS X
brew install realpath
Raspbian
apt-get install coreutils
Docker
docker run cmd.cat/realpath realpath powered by Commando

Display the resolved absolute path for a file or directory. More information: <https://www.gnu.org/software/coreutils/realpath>.

  • Display the absolute path for a file or directory:
    realpath path/to/file_or_directory
  • Require all path components to exist:
    realpath --canonicalize-existing path/to/file_or_directory
  • Resolve ".." components before symlinks:
    realpath --logical path/to/file_or_directory
  • Disable symlink expansion:
    realpath --no-symlinks path/to/file_or_directory
  • Suppress error messages:
    realpath --quiet path/to/file_or_directory

© tl;dr; authors and contributors