Shared Libraries

Most binaries are dynamically linked - they load shared libraries (.so files) at runtime.

CommandPurpose
ldd /path/to/binaryList libraries a binary needs
ldconfigRebuild the linker cache after adding libs
LD_LIBRARY_PATHEnv var adding extra library search dirs

The dynamic linker reads /etc/ld.so.conf (+ /etc/ld.so.conf.d/) and caches results in /etc/ld.so.cache.

$ ldd /bin/ls
        linux-vdso.so.1
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6
Exam tip: A error while loading shared libraries message usually means a .so isn't on the search path - fix by adding its directory to /etc/ld.so.conf.d/ and running ldconfig.