Last updated on November 28, 2020 by Dan Nanni
You can use the following methods to identiy which shared librariies a given program executable (e.g.,
/path/to/program) or a given running process (e.g., PID
1149) depends on.
To find out what libraries a particular executable depends on, you can use
ldd command. This command invokes dynamic linker to find out library dependencies of an executable.
$ ldd /path/to/program
Note that it is not recommended to run
ldd with any untrusted third-party executable because some versions of
ldd may directly invoke the executable to identify its library dependencies, which can be security risk.
Instead, a safer way to show library dependencies of an unknown application binary is to use the following command.
$ objdump -p /path/to/program | grep NEEDED
If you want to find out what shared libraries are loaded by a running process, you can use
pldd command, which shows all shared objects loaded into a process at run-time.
$ sudo pldd <PID>
Note that you need root privilege to run
Alternatively, a command line utility called
pmap, which reports memory map of a process, can also show shared library dependencies of a running process.
$ sudo pmap <PID>
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.