Linux: Find all soft links that link to a specific directory

别说谁变了你拦得住时间么 提交于 2019-12-13 03:48:37

问题


In Linux how do I find all soft links that link to a specific target directory or file?


回答1:


You could use find's -lname argument:

find . -lname linktarget



回答2:


Use find with -samefile and -L option, like this:

find -L -samefile TARGET



回答3:


What R1tschY sez, with an addition:

find -L -samefile TARGET \! -name TARGET

so TARGET won't be included in the result. (The backslash is required in bash so the ! won't be interpreted as a history directive.)



来源:https://stackoverflow.com/questions/9703989/linux-find-all-soft-links-that-link-to-a-specific-directory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!