You can see what shared libraries a specific command uses by using the ldd command. Here is the syntax of the ldd command:
# ldd [options] FILE
For example:
# ldd /bin/cp linux-vdso.so.1 => (0x00007ffc35df9000) libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f93faa09000) libacl.so.1 => /lib64/libacl.so.1 (0x00007f93fa800000) libattr.so.1 => /lib64/libattr.so.1 (0x00007f93fa5fa000) libc.so.6 => /lib64/libc.so.6 (0x00007f93fa239000) libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f93f9fd8000) liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f93f9db2000) libdl.so.2 => /lib64/libdl.so.2 (0x00007f93f9bae000) /lib64/ld-linux-x86-64.so.2 (0x00007f93fac42000) libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f93f9992000)
The purpose of using the ldd command is to troubleshoot problems with code that you are writing. This command tells you not only what libraries are being called, but specifically which directory each library is being called from. This can be extremely useful when a library is not behaving as you would expect it to behave.
ldd Command Options
Option | Description |
---|---|
–version | Print the version number ofldd. |
-v,–verbose | Print all information, including, for example, symbol versioning information. |
-u,–unused | Print unused direct dependencies. (Since glibc 2.3.4.) |
-d,–data-relocs | Perform relocations and report any missing objects (ELF only). |
-r,–function-relocs | Perform relocations for both data objects and functions, and report any missing objects or functions (ELF only). |
–help | Usage information. |