Operating System - Linux
1753481 Members
4184 Online
108794 Solutions
New Discussion

Re: viewing the full path of the linked file

 
SOLVED
Go to solution
H.Becker
Honored Contributor

Re: viewing the full path of the linked file

-m is available at least with 'readlink (GNU coreutils) 6.10'

hb:~/sub/subsub$ readlink -m symlink
/home/hartmut/sub/file
hb:~/sub/subsub$

That may be what you are looking for. But, it's not the full path. -m is explained as "canonicalize by following every symlink in every component of the given name recursively, without requirements on components existence"

hb:~/sub/subsub$ echo "`pwd`/`readlink symlink`"
/home/hartmut/sub/subsub/../detour/../file

Dennis Handly
Acclaimed Contributor

Re: viewing the full path of the linked file

>I am not able to see the full path of the linked file.

Why do you care?
Symlinks to relative paths are good, absolute paths are bad. Think of having them over an NFS mount.

The absolute path would be $PWD/../../bin/ar.