Linux

Where Is the ld.so.cache on Linux?

The linker cache lives at /etc/ld.so.cache, generated from /etc/ld.so.conf.d, and you rebuild it with ldconfig.

Last updated

Linux finds shared libraries through a cache file, not by searching directories at runtime. That cache sits at /etc/ld.so.cache and maps library names to paths for the dynamic linker.

You never edit it by hand. Library paths come from /etc/ld.so.conf and its conf.d drop-ins, and the ldconfig command regenerates the cache from them. Install a library somewhere new, add its path, rerun ldconfig, done.

Where Linux stores this, by platform

Linux
/etc/ld.so.cache

Generated binary cache, do not edit. Source paths live in /etc/ld.so.conf and /etc/ld.so.conf.d/*.conf. Run sudo ldconfig after changes and confirm with ldconfig -p.

Frequently asked questions

why does my program say library not found after installing it

The linker cache predates the install. Add the library directory to /etc/ld.so.conf.d and run sudo ldconfig. Temporary testing can use LD_LIBRARY_PATH instead.

can i delete ld.so.cache

It regenerates with ldconfig, but deleting it breaks every dynamically linked program until you rebuild. Always regenerate rather than remove.

Notice an outdated path? Let us know.