开发者

List symbolic links and location, pointing to a particular directory

开发者 https://www.devze.com 2023-02-02 19:09 出处:网络
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.

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

精彩评论

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