linux – 通过命令行找出符号链接目标

前端之家收集整理的这篇文章主要介绍了linux – 通过命令行找出符号链接目标前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
假设我设置了一个符号链接
ln -s /root/Public/mytextfile.txt /root/Public/myothertextfile.txt

有没有办法看到myothertextfile.txt的目标是使用命令行?

解决方法

使用-f标志打印规范化版本.例如:
readlink -f /root/Public/myothertextfile.txt

来自man readlink:

-f,--canonicalize
      canonicalize by following every symlink in every component of the given name recursively; all but the last component must exist
原文链接:https://www.f2er.com/linux/402960.html

猜你在找的Linux相关文章