List shared libraries
list static libraries
Other object/library exploration tools
The `ldd` command will list the shared libraries used by a given command. This is handy when trying to track down dependencies. If `ldd` is not available on your system then you can instead use ld.so, the dynamic linker and loader (not to be confused with `ld`, the GNU linker). In fact, the `ldd` command is just a shell script around the ld.so linker:
file `which ldd` /usr/bin/ldd: Bourne-Again shell script text executable
You might have to hunt around for the ld.so command in /lib/. It should be a symlink, but it might not exist, which is OK. Just find its canonical name and other aliases:
ls -la /lib/ld* -rwxr-xr-x 1 root root 117348 2009-08-31 11:46 /lib/ld-2.9.so lrwxrwxrwx 1 root root 9 2009-09-14 20:45 /lib/ld-linux.so.2 -> ld-2.9.so lrwxrwxrwx 1 root root 13 2009-07-23 20:36 /lib/ld-lsb.so.1 -> ld-linux.so.2 lrwxrwxrwx 1 root root 13 2009-07-23 20:36 /lib/ld-lsb.so.2 -> ld-linux.so.2 lrwxrwxrwx 1 root root 13 2009-07-23 20:36 /lib/ld-lsb.so.3 -> ld-linux.so.2
See `man ld.so` or `man ld-linux.so`.
The following two examples are equivalent:
ldd /bin/bash /lib/ld-linux.so.2 --list /bin/bash
The `ldd` command has some options, such as -v which return info that can also be obtained with `ld-linux.so.2`. The following two examples produce identical output:
ldd -v /bin/bash LD_TRACE_LOADED_OBJECTS=1 LD_VERBOSE=1 /lib/ld-linux.so.2 /bin/bas
Obviously `ldd` is a little easier to use.
Find missing library dependencies
The following Bash command will list the names of all missing library dependencies in your binary path, $PATH. Unfortunately, this doesn't make it easy to reverse the missing dependency back to the binary that requires it, but usually it is enough just to check that there are no missing libraries.
IFS=:;for BINDIR in $PATH; do ldd $BINDIR/*|grep "not found"|sort -u;done