Linux – How to check if a library is installed

librarieslinux

In Linux, how do I check if a library is installed or not? (from the command line of course).

In my specific case now, I want to check whether libjpeg is installed.

Best Answer

To do this in a distro-independent* fashion you can use ldconfig with grep, like this:

ldconfig -p | grep libjpeg

If libjpeg is not installed, there will be no output. If it is installed, you will get a line for each version available.

Replace libjpeg by any library you want, and you have a generic, distro-independent* way of checking for library availability.

If for some reason the path to ldconfig is not set, you can try to invoke it using its full path, usually /sbin/ldconfig.

**99% of the times*