How to see full symlink path

后端 未结 5 1356
悲&欢浪女
悲&欢浪女 2020-12-22 21:15

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

What is

5条回答
  •  别那么骄傲
    2020-12-22 22:09

    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"))'
    

提交回复
热议问题