Linux: Find all soft links that link to a specific

2019-09-08 01:41发布

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

3条回答
Animai°情兽
2楼-- · 2019-09-08 02:04

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

find -L -samefile TARGET
查看更多
我命由我不由天
3楼-- · 2019-09-08 02:13

You could use find's -lname argument:

find . -lname linktarget
查看更多
迷人小祖宗
4楼-- · 2019-09-08 02:19

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.)

查看更多
登录 后发表回答