如何查看符号链接的完整绝对路径 [英] How to see full absolute path of a symlink

查看:59
本文介绍了如何查看符号链接的完整绝对路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用 ls -la symlinkName stat symlinkName 时,不会显示所有路径(例如 ../../../one/two/file.txt )

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

显示完整路径的linux命令是什么?

What is the linux command that reveals the full path?

推荐答案

realpath 并非在所有linux版本上都可用,但是 readlink 应该可用.

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

readlink -f symlinkName

以上应该可以解决问题.

The above should do the trick.

或者,如果您没有安装上述任何一种软件,那么如果您安装了python 2.6(或更高版本),则可以执行以下操作

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

这篇关于如何查看符号链接的完整绝对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆