$linuxjunkies
>

library

also: shared library, static library, .so, .a, dynamic library

A reusable collection of precompiled functions and code that programs link against to perform common tasks, avoiding code duplication across applications.

A library is a compiled package of functions, classes, and routines that developers can use in their programs. Instead of writing the same functionality repeatedly, programmers link their code to libraries that provide tested, optimized implementations of common operations.

Linux systems typically contain two types: static libraries (ending in .a) that are merged into the final program at compile time, and shared libraries (ending in .so) that multiple programs use simultaneously at runtime, saving disk space and memory.

For example, the libc library provides standard C functions like printf() and malloc() that nearly every C program uses. You can see which shared libraries a program depends on with ldd /path/to/program.

Related terms