linux - 符号链接(symbolic link) : find all files that

大家好,我需要在 linux 中执行此操作:

  • 给定:文件名“foo.txt”
  • 查找:所有指向“foo.txt”的符号链接(symbolic link)的文件

怎么做?谢谢!

最佳答案

这取决于,如果您要查找名为 foo.txt, 的特定文件的链接,那么这是唯一的好方法:

find -L / -samefile path/to/foo.txt

另一方面,如果您只是想找到指向 任何 文件的链接,该文件恰好名为 foo.txt,那么类似

find / -lname foo.txt

find . -lname \*foo.txt # ignore leading pathname components

关于linux - 符号链接(symbolic link) : find all files that link to this file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6184849/

相关文章:

python - 如何检查变量是否为具有 python 2 和 3 兼容性的字符串

linux - 如何在不打开 Linux 的情况下找到所有串行设备(ttyS、ttyUSB、..)?

python - 在文件之间使用全局变量?

linux - 如何通过 * 将包括隐藏文件在内的所有文件移动到父目录中

linux - Java 进程列表

linux - 从 ps -ef |grep 关键字获取 pid

python - 何时在 Python 中使用 %r 而不是 %s?

python - 如何在 Windows 7 的命令提示符中运行 Python 程序?

python - 如何检查浮点值是否为整数

c - [ N ... M ] 在 C 聚合初始值设定项中是什么意思?