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?
精彩评论