ldconfig updates the system’s shared library cache used by the dynamic linker. It scans directories listed in /etc/ld.so.conf and builds /etc/ld.so.cache.
Linux executables link dynamically to shared libraries. Instead of searching every directory each time a program runs, the dynamic linker uses /etc/ld.so.cache.
ldconfig rebuilds that cache.
sudo ldconfig
Run after installing a new shared library manually.
ldconfig -p
Displays all libraries known to the linker.
sudo ldconfig -v
Shows directories scanned and links created.
sudo ldconfig /usr/local/lib
Useful after installing custom-built libraries.
ldconfig -p | grep ssl
Confirm whether a library is registered.
sudo ldconfig -X
Skips updating symbolic links.
sudo ldconfig -N
Does not rebuild the cache file.
sudo ldconfig -r /mnt/sysroot
Used when preparing chroot or container environments.
ls -l /usr/lib/libexample.so*
Ensure correct .so symlink chain exists.
sudo ldconfig ldd /path/to/program
Rebuild cache, then inspect binary dependencies.
/usr/local/lib.LD_LIBRARY_PATH can override cache behavior.ldd after troubleshooting to confirm resolution.