I need to list the programs which have a specified shared library linked to them in UNIX/Linux (like ldd but vice versa)

陌路散爱 提交于 2019-12-12 00:21:52

问题


ldd command in unix/linux lists all the dinamically linked libraries of a program.

how can I determine the reverse question:
what is the list of programs linked to a specified shared library?

I need a way of getting a list of programs that use "libz" for instance.

is there a command for that?


回答1:


I highly doubt there would be. That would require keeping a database of all executables and remembering what they depend on, which may be possible if you only install software from a specific channel, but it certainly won't be able to track executables you produce otherwise. Not to mention such a database is largely useless and therefore not attractive.

If you need to find such executables however (e.g. to know if it's safe to remove the shared library), you can easily find most of them. The key is that most of the executables you have are inside /usr/bin or /usr/local/bin or similar locations. So all you need is to run ldd on all files inside those directories and grep for the library you are looking for.



来源:https://stackoverflow.com/questions/22543419/i-need-to-list-the-programs-which-have-a-specified-shared-library-linked-to-them

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