Check a binary's shared libraries with `ldd`
The command behind 'error while loading shared libraries: libX.so.1: cannot open' — ldd lists every needed .so and whether it resolves.
Run `ldd /path/to/binary` to list its shared library dependencies; any line reading `not found` is the missing library to install or ship.
01Command
Command
$ ldd /usr/bin/some-binary02What it does
Each output line maps a needed library (e.g. libssl.so.3) to its resolved path; 'not found' means the dynamic linker can't locate it, which you fix by installing the package or extending the search path with `LD_LIBRARY_PATH`. The man page's forgotten security note matters: ldd works by running the program's loader, so never use it on untrusted binaries — use `objdump -p binary | grep NEEDED` instead. Related and forgotten: `ldconfig -p` shows every library the system cache knows about.
03Risk
!Warning: Never run ldd on untrusted executables — it can execute arbitrary code from the binary's loader.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- ldd(1) — print shared object dependenciesEvidence: Documents ldd output and its security note: ldd executes the binary's loader and should not be run on untrusted executables
Last verified: 2026-09-17 · Category: Developer