# ldconfig(8) - man - phpman

> **TLDR:** Configure symlinks and cache for shared library dependencies.
>
- Update symlinks and rebuild the cache (usually run when a new library is installed):
  `sudo ldconfig`
- Update the symlinks for a given directory:
  `sudo ldconfig -n {{path/to/directory}}`
- Print the libraries in the cache and check whether a given library is present:
  `ldconfig {{-p|--print-cache}} | grep {{library_name}}`

*Source: tldr-pages*

---

[LDCONFIG(8)](https://www.chedong.com/phpMan.php/man/LDCONFIG/8/markdown)                           Linux Programmer's Manual                          [LDCONFIG(8)](https://www.chedong.com/phpMan.php/man/LDCONFIG/8/markdown)



## NAME
       ldconfig - configure dynamic linker run-time bindings

## SYNOPSIS
       **/sbin/ldconfig** [**-nNvXV**] [**-f** _conf_] [**-C** _cache_] [**-r** _root_] _directory_...
       **/sbin/ldconfig** **-l** [**-v**] _library_...
### /sbin/ldconfig -p

## DESCRIPTION
       **ldconfig**  creates  the necessary links and cache 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, _/lib_ and _/usr/lib_ (on some 64-bit architectures such as x86-64, _/lib_ and
       _/usr/lib_ are the trusted directories for 32-bit libraries, while _/lib64_  and  _/usr/lib64_  are
       used for 64-bit libraries).

       The  cache  is used by the run-time linker, _ld.so_ or _ld-linux.so_.  **ldconfig** checks the header
       and filenames of the libraries it encounters when  determining  which  versions  should  have
       their links updated.

       **ldconfig**  will attempt to deduce the type of ELF libraries (i.e., libc5 or libc6/glibc) based
       on what C libraries, if any, the library was linked against.

       Some existing libraries do not contain enough information to allow  the  deduction  of  their
       type.   Therefore,  the  _/etc/ld.so.conf_  file format allows the specification of an expected
       type.  This is used _only_ for those ELF libraries which we can not work out.   The  format  is
       "dirname=TYPE",  where  TYPE  can  be libc4, libc5, or libc6.  (This syntax also works on the
       command line.)  Spaces are _not_ allowed.  Also see the **-p** option.  **ldconfig** should normally be
       run  by  the  superuser as it may require write permission on some root owned directories and
       files.

       Note that **ldconfig** will only look at files that are named _lib*.so*_ (for  regular  shared  ob‐
       jects)  or _ld-*.so*_ (for the dynamic loader itself).  Other files will be ignored.  Also, **ld**‐‐
       **config** expects a certain pattern to how the symlinks are set up, like this example, where the
       middle file (**libfoo.so.1** here) is the SONAME for the library:

           libfoo.so -> libfoo.so.1 -> libfoo.so.1.12

       Failure to follow this pattern may result in compatibility issues after an upgrade.

## OPTIONS
### -c --format=
              (Since glibc 2.2) Cache format to use: _old_, _new_, or _compat_.  Since glibc 2.32, the de‐
              fault is _new_.  Before that, it was _compat_.

### -C
              Use _cache_ instead of _/etc/ld.so.cache_.

### -f
              Use _conf_ instead of _/etc/ld.so.conf_.

### -i --ignore-aux-cache
              (Since glibc 2.7) Ignore auxiliary cache file.

### -l
              by experts only.

### -n
              directories, nor those specified in _/etc/ld.so.conf_.  Implies **-N**.

### -N -X

### -p --print-cache
              Print the lists of directories and candidate libraries stored in the current cache.

### -r
              Change to and use _root_ as the root directory.

### -v --verbose
              Verbose mode.  Print current version number, the name  of  each  directory  as  it  is
              scanned, and any links that are created.  Overrides quiet mode.

### -V --version
              Print program version.

### -X -N

## FILES
       _/lib/ld.so_
              Run-time linker/loader.
       _/etc/ld.so.conf_
              File containing a list of directories, one per line, in which to search for libraries.
       _/etc/ld.so.cache_
              File  containing  an  ordered  list of libraries found in the directories specified in
              _/etc/ld.so.conf_, as well as those found in the trusted directories.

## SEE ALSO
       [**ldd**(1)](https://www.chedong.com/phpMan.php/man/ldd/1/markdown), [**ld.so**(8)](https://www.chedong.com/phpMan.php/man/ld.so/8/markdown)

## COLOPHON
       This page is part of release 5.10 of the Linux  _man-pages_  project.   A  description  of  the
       project,  information about reporting bugs, and the latest version of this page, can be found
       at <https://www.kernel.org/doc/man-pages/>.



GNU                                          2020-06-09                                  [LDCONFIG(8)](https://www.chedong.com/phpMan.php/man/LDCONFIG/8/markdown)
