Is there a Unix command to get the absolute (and canonicalized) path from a relative path which may contain symbolic links?
Shell – Convert Relative Path to Absolute Path Without Symbolic Link
directoryfilenamesshellsymlink
directoryfilenamesshellsymlink
Is there a Unix command to get the absolute (and canonicalized) path from a relative path which may contain symbolic links?
Best Answer
You can use the
readlink
utility, with the-f
option:Some distributions, for example those that use GNU coreutils and FreeBSD, also come with a
realpath(1)
utility that basically just callsrealpath(3)
and does pretty much the same thing.