Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to get the list of installed library packages only from terminal.

Is there any command for that?

share|improve this question
up vote 5 down vote accepted
/sbin/ldconfig -p

The -v option will show the libraries version.


267 libs found in cache `/etc/' (libc6) => /usr/lib/ (libc6) => /usr/lib/ (libc6) => /usr/lib/ (libc6) => /usr/lib/ (libc6) => /usr/lib/ (libc6) => /usr/lib/ (libc6) => /lib/ (libc6) => /lib/ (libc6) => /lib/ (libc6, hwcap: 0x8008000000008000, OS ABI: Linux 2.6.8) => /lib/tls/i686/cmov/ (libc6, OS ABI: Linux 2.6.8) => /lib/ (libc6, OS ABI: Linux 2.6.8) => /usr/lib/ (libc6) => /lib/ (libc6) => /usr/lib/ (libc6) => /lib/ (libc6) => /usr/lib/ (libc6) => /usr/lib/ (libc6) => /usr/lib/ (libc6) => /lib/

If you want to turn that list into a list of packages, you can do something like this:

dpkg -S $(/sbin/ldconfig -p | awk 'NR>1 { print $NF }')

And you can further massage that to cut out errors, unneeded components and duplicates:

$ dpkg -S $(/sbin/ldconfig -p | awk 'NR>1 { print $NF }') 2>/dev/null | sed 's/\: .*$//' | sort -u
share|improve this answer

I'm not sure there's a guaranteed way to know from a package name that a package is a "library" (if that's even a solid definition in itself) but you can find installed packages that start and end with lib fairly easily:

dpkg -l | awk '($1 == "ii") && ($2 ~ /^lib|lib$/) { print $2 }'

Some packages contain "lib" that aren't libraries. You'll probably need to exclude librarian and libreoffice from those:

dpkg -l | awk '($1 == "ii") && ($2 ~ /^lib|lib$/) && ($2 !~ /^(libreoffice|librarian)/) { print $2 }'

This is still going to miss out a dearth of python-... libraries.

share|improve this answer

And aptitude came to the rescue:

aptitude search '?and(?section(libs), ~i)'

It reads: looks for packages that contains libs in their ?section and that are installed (~i).

You can use this to look for just all libraries in your repository:

aptitude search '?section(libs)'

This method obviously need of aptitude.

share|improve this answer
Note, this will work if the packages comply with Debian policies. If a library isn't in the library section, then it will not be included, even if it's a library. – Braiam Mar 14 '14 at 12:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.