2.2 KiB
Linux FAQs with Answers--How to check what libraries are used by a program or process on Linux
Question: I would like to know which shared libraries are loaded at run-time when I invoke a particular executable. Is there any way to identify shared library dependencies of a program executable or a running process on Linux?
Check shared library dependencies of a program executable
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
Check shared library dependencies of a running process
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 pldd command.
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>
via: http://ask.xmodulo.com/check-library-dependency-program-process-linux.html