realpath script.sh

Category: Administration

realpath script.sh

Resolve a path to its absolute form

realpath prints the canonical absolute path, resolving symlinks and collapsing .. segments along the way. It answers questions like where this script really lives when launched through a symlink. Use it in scripts before cd-ing or storing paths.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.