开发者

List symbolic links and location, pointing to a particular directory

How to list all symbolic links that are pointing to a particular directory in Solaris?

I used find command on root directory and grep o开发者_如何学JAVAn top of it. This is extremely slow.

please suggest any other alternatives.


You can use this command, replace targetdir by the directory your are looking for:

TARGET=targetdir; find . -type l -exec ls -l {} \; | grep -- "-> $TARGET";


Symbolic links are uni-directional and 'entirely contained' in each link file - there's no separate list of links, or reverse link - you'll have to use find.

I presume you're using find / -type l to restrict 'find' to only report files that are symbolic links.

Have you restricted the search to eliminate areas that definitely won't contain links to your directory-in-question?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜