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

StackOverflow https://stackoverflow.com/questions/22543419

Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top