How to list installed packages in Debian or Ubuntu

If you want to see what packages are installed in Debian or Ubuntu system use following commands:

To list all the package installed:

dpkg-query -l

This will return something similar to this:

dpkg-query -l
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name        Version    Architecture      Description
+++-================================-=====================-
ii  adduser    3.113+nmu3  all   add and remove users and groups
ii  alsa-base  1.0.25+3    all   ALSA driver configuration files
ii  alsa-utils 1.0.27.1-1  i386  Utilities for configuring and using ALSA

To show status of all packages in the system

dpkg -l

This will return a long list so it will be good idea to pipe it to less or more:

dpkg -l

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name        Version    Architecture      Description
+++-================================-=====================-
ii  adduser    3.113+nmu3  all   add and remove users and groups
ii  alsa-base  1.0.25+3    all   ALSA driver configuration files
ii  alsa-utils 1.0.27.1-1  i386  Utilities for configuring and using ALSA

To list installed packages you can also use

dpkg --get-selections

It returns

dpkg --get-selections
adduser install
alsa-base install
alsa-utils install

In addition this allows you to save the software installed by using

dpkg --get-selections > /mybackup/installed-packages.log

and restore on on different machine by issuing

dpkg --set-selections < /mybackup/installed-packages.log
apt-get dselect-upgrade

If you want to see locations where package files reside use

 dpkg -L

This returns:

 dpkg -L alsa-base
/.
/etc
/etc/modprobe.d
/etc/modprobe.d/alsa-base.conf
/etc/modprobe.d/alsa-base-blacklist.conf
/etc/default
/etc/default/alsa-base
/usr
/usr/sbin
/usr/sbin/alsa
/usr/share
/usr/share/doc
/usr/share/doc/alsa-base
/usr/share/doc/alsa-base/NEWS.Debian.gz
/usr/share/doc/alsa-base/changelog.gz
/usr/share/doc/alsa-base/copyright
/usr/share/doc/alsa-base/README.Debian
/usr/share/bug
/usr/share/bug/alsa-base
/usr/share/bug/alsa-base/presubj
/usr/share/bug/alsa-base/control
/usr/share/bug/alsa-base/script
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/alsa-base
/usr/share/alsa-base

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.