Linux programs can share library code. ldd shows the shared libraries a trusted Linux executable resolves and identifies dependencies that are not found.
ldd asks the dynamic loader to trace the shared objects for a trusted ELF executable or shared object. Lines with ⇒ show the required library name and the file selected by the loader, while not found marks a dependency missing from the active search rules. The listing does not enumerate every plugin or library an application loads later through its own logic, such as a call to dlopen.
Use readelf or objdump for binaries from untrusted sources because ldd can run loader-controlled code on some inputs. Direct ELF metadata only shows entries such as NEEDED libraries, while ldd remains the better check for a trusted binary when runtime search paths and transitive dependencies matter.
Steps to show shared library dependencies in Linux:
- Run ldd on the trusted executable or shared object.
$ ldd /usr/bin/bash linux-vdso.so.1 (0x0000ffff941dc000) libtinfo.so.6 => /usr/lib/aarch64-linux-gnu/libtinfo.so.6 (0x0000ffff93f90000) libc.so.6 => /usr/lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff93dc0000) /lib/ld-linux-aarch64.so.1 (0x0000ffff94190000)
The target can be an executable, plugin, or other shared object. A resolved line shows the library name on the left and the selected file path on the right.
A statically linked executable or a non-ELF file such as a shell script can produce not a dynamic executable instead of a dependency list. This differs from a listed library marked not found. A shell script's interpreter is a separate executable with its own dependencies.
- Check the output for unresolved libraries.
$ ldd /opt/report/bin/report-runner linux-vdso.so.1 (0x0000ffffbbe07000) libreportcore.so.3 => not found libc.so.6 => /usr/lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffbbbc0000) /lib/ld-linux-aarch64.so.1 (0x0000ffffbbdc0000)
Do not copy a random .so file into a system library directory to make this line disappear. The cause may be a missing package, an incomplete application bundle, or an incorrect loader search path for that application.
- Re-run ldd once the missing dependency is available to the loader.
$ ldd /opt/report/bin/report-runner linux-vdso.so.1 (0x0000ffff8aaef000) libreportcore.so.3 => /opt/report/lib/libreportcore.so.3 (0x0000ffff8aa40000) libc.so.6 => /usr/lib/aarch64-linux-gnu/libc.so.6 (0x0000ffff8a870000) /lib/ld-linux-aarch64.so.1 (0x0000ffff8aaa0000)
The absence of not found confirms that the loader can resolve the listed dependencies. Run the program's normal functional test when startup alone does not prove the application works.
- Read direct ELF dependency entries without invoking the loader.
$ readelf --dynamic /usr/bin/bash Dynamic section at offset 0x17f5f8 contains 30 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libtinfo.so.6] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x0000000000000001 (NEEDED) Shared library: [ld-linux-aarch64.so.1] ##### snipped #####
readelf --dynamic reads the file metadata. The NEEDED rows are direct dependencies recorded in the binary, not the full runtime dependency tree.
- Use verbose ldd output when symbol version requirements matter.
$ ldd --verbose /usr/bin/bash linux-vdso.so.1 (0x0000ffffb46b5000) libtinfo.so.6 => /usr/lib/aarch64-linux-gnu/libtinfo.so.6 (0x0000ffffb4470000) libc.so.6 => /usr/lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffb42a0000) /lib/ld-linux-aarch64.so.1 (0x0000ffffb4670000) Version information: /usr/bin/bash: ld-linux-aarch64.so.1 (GLIBC_2.17) => /lib/ld-linux-aarch64.so.1 libtinfo.so.6 (NCURSES6_TINFO_5.0.19991023) => /usr/lib/aarch64-linux-gnu/libtinfo.so.6 libc.so.6 (GLIBC_2.25) => /usr/lib/aarch64-linux-gnu/libc.so.6 ##### snipped #####
Version rows help compare a binary against libraries on another host when a program works on one system but fails after copying, upgrading, or restoring it.