Last Updated: 2023-02-05
  • .so: "shared-object", shared library, "dynamically linked" to programs at runtime, loaded only when needed. Like .dll in windows, .dylib in macOS (dynamic library extension).
  • .a: "Archive libraries", statically linked: when you compile your program with -c option in gcc. If there's any change in library, you need to compile and build your code again.
  • .ko: Loadable kernel modules - object files that are used to extend the kernel of the Linux Distribution. Live in /lib/modules/ folder.


.so files may or may not have a number suffix:

  • e.g. libLLVM-11.so: a symlink which does not have a number associated.
  • e.g. libLLVM-11.so.1: each file has a different number at the end of it. These numbers represent versions of the library.

To check which version is the symlink pointing to:

$ ls -lah /lib/x86_64-linux-gnu/libLLVM-11.so*

/lib/x86_64-linux-gnu/libLLVM-11.so -> libLLVM-11.so.1

.so files are often found in the following Linux directories:


Find .so dependencies: use ldd. E.g. list the runtimes dependencies of ls.

$ ldd `which ls`

To find some .so files in cache: (-p = --print-cache)

$ ldconfig -p

View a list of the functions an SO file contains.

$ nm -D /lib/x86_64-linux-gnu/libc.so.6

Get metadata (elf=Executable and Linkable Format, ELF is the standard binary format on operating systems such as Linux.)

$ readelf -d /lib/x86_64-linux-gnu/libLLVM-11.so.1

The advantage of .so (shared object) over .a library is that they are linked during the runtime i.e. after creation of your .o file -o option in gcc. So, if there's any change in .so file, you don't need to recompile your main program.