List Installed Packages on Your Ubuntu Linux

If you’re interested in what exactly your Ubuntu system has got installed, there’s a command you can use to list the packages along with their versions and short descriptions.

How packages information is stored in Ubuntu

Essentially being a fork of the Debian Linux, Ubuntu inherited quite a lot of things from it. One of them is the way packages are installed and managed.

dpkg (Debian Package Manager) is a command found in every Ubuntu installation. While managing software packages, it stores all the files it depends upon in a /var/lib/dpkg directory. Most of these files you can look into using basic Unix commands, but there’s really no need because dpkg does it for you.

For example, status of all the installed packages is stored in /var/lib/dpkg/status file. Here’s how it looks, just to give you an idea:

Package: bash
Essential: yes
Status: install ok installed
Priority: required
Section: shells
Installed-Size: 2012
Maintainer: Ubuntu Core developers <[email protected]>
Architecture: amd64
Version: 3.2-0ubuntu7
Replaces: bash-doc (<= 2.05-1), bash-completion
Depends: base-files (>= 2.1.12), debianutils (>= 2.15)
Pre-Depends: libc6 (>= 2.5-0ubuntu1), libncurses5 (>= 5.4-5)
Suggests: bash-doc
Conflicts: bash-completion
Conffiles:
/etc/skel/.bashrc 52acca91b52f797661c89b181809b9f3
/etc/skel/.profile 7d97942254c076a2ea5ea72180266420
/etc/skel/.bash_logout 22bfb8c1dd94b5f3813a2b25da67463f
/etc/bash.bashrc 860d464fca66fff1af4993962a253611
/etc/bash_completion c8bce25ea68fb0312579a421df99955c
/etc/skel/.bash_profile d1a8c44e7dd1bed2f3e75d1343b6e4e1 obsolete
Description: The GNU Bourne Again SHell
Bash is an sh-compatible command language interpreter that executes
commands read from the standard input or from a file. Bash also
incorporates useful features from the Korn and C shells (ksh and csh).

As you can see, there’s all the possible information about bash package (the Bourne Again Shell), but you usually don’t need to know this much, so instead we’ll use dpkg command to confirm what packages are installed and which ones are not.

List installed packages with dpkg

The easiest way to confirm the list of packages installed on your Ubuntu OS is to run dpkg -l command. The output is quite long, so I’ll only show you a fragment of it:

ubuntu# dpkg -l | more
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-==========================-============================================-============================================
ii adduser 3.100 Add and remove users and groups
ii alsa-base 1.0.13-3ubuntu1 ALSA driver configuration files
ii alsa-utils 1.0.13-1ubuntu5 ALSA utilities
ii apache2 2.2.3-3.2ubuntu2.1 Next generation, scalable, extendable web se
rc apache2-common 2.0.55-4ubuntu4 next generation, scalable, extendable web se
ii apache2-doc 2.2.3-3.2ubuntu2.1 documentation for apache2
ii apache2-mpm-prefork 2.2.3-3.2ubuntu2.1 Traditional model for Apache HTTPD 2.1
ii apache2-utils 2.2.3-3.2ubuntu2.1 utility programs for webservers
ii apache2.2-common 2.2.3-3.2ubuntu2.1 Next generation, scalable, extendable web se
ii apt 0.6.46.4ubuntu10 Advanced front-end for dpkg
ii apt-utils 0.6.46.4ubuntu10 APT utility programs
ii aptitude 0.4.4-1ubuntu3 terminal-based apt frontend
ii at 3.1.10ubuntu4 Delayed job execution and batch processing
ii autoconf 2.61-3 automatic configure script builder
ii automake1.4 1.4-p6-12 A tool for generating GNU Standards-complian
ii automake1.9 1.9.6+nogfdl-3ubuntu1 A tool for generating GNU Standards-complian
ii autotools-dev 20060920.1 Update infrastructure for config.{guess,sub}
ii awstats 6.5+dfsg-1ubuntu3 powerful and featureful web server log analy
ii base-files 4ubuntu2 Debian base system miscellaneous files

The legend at the very top of the output explains the first 3 charactes of each line in the dpkg output, the symbols there confirm whether each package is expected to be installed, and whether it’s actually installed or partially installed:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=b
||/ Name Version Description
+++-==========================-============================================-============================================
ii adduser 3.100 Add and remove users and groups

A first letter of each option is used, so ii for the adduser package in this example means that the desired state for this package is “Installed” (first i) and the actual status is “Installed” as well. That’s the normal condition for most of your packages.

As you can also see, each line shows you the version of each package you have and provides a brief description of what a package is used for.

That’s it, this should be a good start for your Ubuntu exploration, I’ll post a few more things about dpkg in the future.

See also

  • Debian Linux
  • Finding out the release version of your Unix
  • apt-get behind proxy



Keep Learning

Follow me on Facebook, Twitter or Telegram:
Recommended
I learn with Educative: Educative
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!

Recent Tweets