How to check what have installed in Debian/Ubuntu

November 21st, 2006 mysurface Posted in Admin, dpkg, dpkg-query | Hits: 92494 | 5 Comments »

To check what have install by listing all using dpkg is easy.

dpkg -l

To check whether a package is install also easy.

dpkg -l | grep apache

The command above is some how redundant, because dpkg support wild characters, doing this instead

dpkg -l "apache*"

By doing this, it will also list the package that not install but available in dpkg cache, to install them you can simply apt-get. To indicate the packages installed it shows “ii” and not install shows “un”.

To know more, sometimes we wanna know what files is installed with the package. But with this query, you need to put the exact package name.

dpkg -L apache2

As contrast, if you wanna know the command(binaries) are from which package installed, check out this example.

To list more simple result for script manipulation? You can check out dpkg-query, it support -l and -L and more options. For example, -W will list only the package name and the version for installed packages.

dpkg-query -W "apache*"

To be more specific, check out the dpkg manual at -f, you can specified what should only output. A simple example, where I just want the package name.

dpkg-query -W -f='${Package}\n' "apache*"

5 Responses to “How to check what have installed in Debian/Ubuntu”

  1. dpkg -l | grep kde | cut -d” ” -f3 -s

    shows me installed kde packages, assuming this is a server, how do I purge these?

  2. aptitude purge `dpkg -l | grep kde | cut -d” ” -f3 -s`

    Is the Answer!

  3. Kenneth,

    What about to remove the “Residual” packages (as in Synaptic Package Manager), is it the same as ‘aptitude purge’ ?

  4. It would be very usefull include information about how to redirect it to packages.log or packages.txt file .

    I am specially interested in list only : package name, package status (installed, broken, removed), dependencies to install (specially in broken packages), version number, release (stable, testing, unstable), in a similar way to

    How can I do it ?.


  5. […] How to check what have installed in Debian/Ubuntu » Linux by Examples To check what have install by listing all using dpkg is easy. […]

Leave a Reply