ldd(1)
Print the shared object dependencies of ELF binaries and libraries.
Synopsis
ldd [OPTION]... FILE...Description
ldd prints the names and addresses of the shared libraries (dynamic dependencies) that a compiled binary or shared object requires to run. It reads the ELF header to identify required libraries and resolves them using the dynamic linker.
Use ldd to debug missing library errors, verify library versions, or understand what a binary depends on. It only works on ELF binaries; it will fail on shell scripts or static binaries.
Common options
| Flag | What it does |
|---|---|
-v | Verbose mode; print all symbol resolutions and version information |
-u | Print unused direct dependencies (symbols not referenced by the binary) |
-d | Perform relocations and report missing symbols; do not execute the binary |
-r | Perform relocations for both needed objects and immediate symbols |
--help | Display help message and exit |
Examples
List all shared libraries required by the ls command
ldd /bin/lsVerbosely list Python's dependencies with symbol resolution details
ldd -v /usr/bin/python3Show unused direct library dependencies that myapp doesn't actually call
ldd -u /opt/myapp/binaryFind missing libraries without executing the binary
ldd -d ./a.out 2>&1 | grep 'not found'Show only the C library dependency of bash
ldd /bin/bash | grep libcInspect the dynamic linker itself (lists its dependencies, if any)
ldd /lib64/ld-linux-x86-64.so.2