How to see full absolute path of a symlink

141

When I'm using ls -la symlinkName or stat symlinkName not all the path is displayed (e.g ../../../one/two/file.txt)

What is the linux command that reveals the full path?

This question is tagged with linux symlink

~ Asked on 2013-04-15 14:15:50

The Best Answer is


247

realpath isn't available on all linux flavors, but readlink should be.

readlink -f symlinkName

The above should do the trick.

Alternatively, if you don't have either of the above installed, you can do the following if you have python 2.6 (or later) installed

python -c 'import os.path; print(os.path.realpath("symlinkName"))'

~ Answered on 2013-04-15 14:32:37


31

realpath <path to the symlink file> should do the trick.

~ Answered on 2013-04-15 14:26:48


Most Viewed Questions: