ldconfig: command not found

ldconfig is a command-line tool that is used to configure the dynamic linker run-time bindings, by creating, updating, and removing symbolic links and cache files for shared libraries on a Linux system. It is typically run as a system administrator task, typically at boot time and after installing new shared libraries.

The ldconfig command reads the file /etc/ld.so.conf and the directories specified in that file, and creates a cache file that is used by the dynamic linker, ld.so, to resolve shared library dependencies at runtime. The cache file is typically located at /etc/ld.so.cache.

When ldconfig is run, it scans the specified directories and creates symbolic links in the standard library directories, such as /usr/lib, /lib, and /usr/local/lib, that point to the shared libraries found in the scanned directories. It also creates the cache file that is used by the dynamic linker to resolve shared library dependencies at runtime. By default, ldconfig will scan the directories specified in /etc/ld.so.conf, but you can also specify additional directories to scan on the command line. You can use the -p option to display the current contents of the cache file and -v option to see which libraries are being processed.

If you encounter the below error while running the command ldconfig:

ldconfig: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install glibc-source
Ubuntu apt-get install eglibc-source
Arch Linux pacman -S glibc
Kali Linux apt-get install libc-bin
CentOS yum install glibc
Fedora dnf install glibc
Raspbian apt-get install eglibc-source

ldconfig Command Examples

1. Update symlinks and rebuild the cache (usually run when a new library is installed):

# sudo ldconfig

2. Update the symlinks for a given directory:

# sudo ldconfig -n path/to/directory

3. Print the libraries in the cache and check whether a given library is present:

# ldconfig -p | grep library_name

Summary

In summary, ldconfig is a command-line tool that configures the dynamic linker run-time bindings, by creating, updating, and removing symbolic links and cache files for shared libraries on a Linux system. It is typically run as a system administrator task, typically at boot time and after installing new shared libraries. It helps ensure that the system can find and use all of the necessary shared libraries for the programs that are installed on the system.

Related Post