Managing Shared Libraries

In Windows we’re familiar with .dll files, Dynamically Linked Libraries. In Unix, these are generally known as Shared Objects, or .so files. For the most part, these contain functions used in common by many applications.

Some applications are statically linked. This means that all the libraries used by an app are compiled right into the app, which results in larger files.

Wherever possible, applications are dynamically linked, which means any necessary libraries are loaded as needed from the main system. Thus the computer system must have the necessary libraries, but only one copy for every app that uses them. This frees up disk space, among other things.

You can find out what libraries an executable requires with the ldd command:

ldd /usr/bin/X11/xterm

Programs that use libraries use the component, which is responsible for finding and loading the library. looks at the file /etc/ for a list of directories containing shared libraries, in a manner similar to the way a shell uses your PATH to search for command binaries. also looks in /usr/lib and /lib, regardless of what says.

Use the ldconfig command to check all these libraries and directories, update any links as necessary, and cache libraries where necessary: