Software & Apps Linux ldconfig — Linux Command — Unix Command Use 'ldconfig' to set up appropriate links and caches for system libraries by Juergen Haas Writer Former Lifewire writer Juergen Haas is a software developer, data scientist, and a fan of the Linux operating system. our editorial process Juergen Haas Updated on July 21, 2020 Tweet Share Email Linux Switching from Windows The ldconfig Linux command creates the necessary links and cache (for use by the run-time linker, ld.so) to the most recent shared libraries found in the directories specified on the command line, in the file /etc/ld.so.conf, and in the trusted directories (/usr/lib and /lib). It checks the header and file names of the libraries it encounters when determining which versions should have their links updated; it ignores symbolic links when scanning for libraries. Ldconfig will attempt to deduce the type of ELF libs (ie. libc 5.x or libc 6.x (glibc)) based on what C libraries if any the library was linked against, therefore when making dynamic libraries, it is wise to explicitly link against libc (use -lc). Ldconfig should normally be run by the super-user as it may require write permission on some root owned directories and files. If you use -r option to change the root directory, you don't have to be super-user as long as you have sufficient rights to that directory tree. Jag Images / Getty Images Synopsis The command takes the following general format: ldconfig [OPTION...] Options The command supports the following options: -v: Verbose mode. Print current version number, the name of each directory as it is scanned and any links that are created. -n: Only process directories specified on the command line. Don't process the trusted directories (/usr/lib and /lib) nor those specified in /etc/ld.so.conf. Implies -N. -N: Don't rebuild the cache. Unless -X is also specified, links are still updated. -X: Don't update links. Unless -N is also specified, the cache is still rebuilt. -f conf: Use conf instead of /etc/ld.so.conf. -C cache: Use cache instead of /etc/ld.so.cache. -r root: Change to and use root as the root directory. -l: Library mode. Manually link individual libraries. Intended for use by experts only. -p: Use print-cache to print the lists of directories and candidate libraries stored in the current cache. -c: format=FORMAT: Specify the format for the cache file. Choices are old, new and compat (the default). -?, help/usage: Display usage information. -V – version: Shows the program version. Examples Use ldconfig to set links. For example, # /sbin/ldconfig -v establishes the correct links for the shared binaries and rebuilds the cache, while running # /sbin/ldconfig -n /lib as root after the installation of a new shared library will properly update the shared library symbolic links in /lib. Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Email Address Sign up There was an error. Please try again. You're in! Thanks for signing up. There was an error. Please try again. Thank you for signing up. Tell us why! Other Not enough details Hard to understand Submit