符号链接:查找链接到该文件的所有文件 [英] symbolic link: find all files that link to this file
本文介绍了符号链接:查找链接到该文件的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,我需要在linux中这样做:
Hallo all, I need to do this in linux:
- 给出:文件名'foo.txt'
- 查找:所有指向'foo.txt'的符号链接的文件
该怎么做?谢谢!
推荐答案
这取决于您是否要查找指向名为foo.txt,
的特定文件的链接,但这是唯一的好方法:
It depends, if you are trying to find links to a specific file that is called foo.txt,
then this is the only good way:
find -L / -samefile path/to/foo.txt
另一方面,如果您只是想查找指向恰好名为foo.txt
的任何文件的链接,则类似
On the other hand, if you are just trying to find links to any file that happens to be named foo.txt
, then something like
find / -lname foo.txt
或
find . -lname \*foo.txt # ignore leading pathname components
这篇关于符号链接:查找链接到该文件的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文