How To List Installed Packages On Ubuntu And Debian Based Systems

Check out our beginner friendly guide to learn how to list installed packages on Ubuntu and Debian based systems within the command line.

On this page
  1. What Is A Package Management System?
  2. Introduction
  3. List Installed Packages
  4. List A Specific Package
  5. Getting A Count Of The Installed Packages
  6. Bonus
  7. Conclusion
  8. Additional Links

In this blog post, we will look at how to check installed packages on Ubuntu and Debian-based systems. This includes how to generate a list of all the installed packages, checking for a specific package, getting a count of the number of installed packages, and creating a text file of the installed packages. From there a bonus section with even more related like how to get more information about a specific package, where apt and dpkg log to, and even how to list packages installed using newer packager managers like Snap and Flatpak.

#What Is A Package Management System?

The concept of package managers has been around for quite some time, but to summarize the original concept was to centralize software distribution methods. The concept is to have one place to install, upgrade, configure, and remove software packages.

#Introduction

Linux systems have different options in package management systems like RPM. Ubuntu and Debian-based systems generally use .deb files as their primary method of package management. On these systems, apt or dpkg are going to be the likely frontends you will find for interacting with these packages.

#List Installed Packages

To list the installed packages using apt package manager use the command below (be warned there will be quite a few)

Code
apt list --installed

Image of the output from the command apt list --installed

If you’re on a system that doesn’t have apt try this dpkg command instead.

Code
sudo dpkg -l

#List A Specific Package

If you’re looking to confirm if a specific package is installed you can add the package name to the command as shown below.

Code
apt list --installed [package]

The same goes for dpkg.

Code
dpkg -l pattern

#Getting A Count Of The Installed Packages

This command will count the number of times installed is listed to provide a count of the number of installed packages.

Code
apt list --installed | grep -c installed

This will do the same for the dpkg output

Code
dpkg -l | grep -c '^ii'

#Bonus

Creating A List Of Installed Packages

It’s possible to create a list that can then be restored on another system to install the same packages.

To create the file use the below command.

Code
dpkg -l | grep '^ii' | awk '{print $2}' > installed_packages.txt

To restore the packages use the following command.

Code
xargs -a installed_packages.txt sudo apt-get install -y

Need More Information About A Package?

If you’re looking for more details about a package try running the apt show command with the package name appended to it as shown below.

Code
apt show [package]

The result will look like the following example ran on the bash command.

results of the command apt show bash

Logs

If you are looking for logs as to when a package was installed I would recommend starting by reviewing the logs listed below.

  • /var/log/dpkg.log
  • /var/log/apt/history.log

Other Package Managers You Might Find

In recent years there have been several new packages come into existence trying to solve issues like compatibility, security, and other modern concerns. The two of those you are most likely to see are called Snap and Flatpak and the commands to list installed packages are listed below.

Snap

Snap is a software packaging and deployment system developed by Canonical. To list installed packages via snap run the following command.

Code
snap list

If you get a message that the command is not found that means snap isn’t installed.

Flatpak

Flatpak is simmular to snaps, although it should be noted there are many differences in the technologies. To see if there are any installed packages via flatpak run the following command.

Code
flatpak list

If you get a message that the command is not found that means snap flatpak installed.

#Conclusion

Although we only covered listing installed packages on Ubuntu and Debian-based systems we started by touching on what a packager manager is, moving on ways to list traditionally installed packages. From there the bonus section has a variety of information, from creating a list of installed packages and getting more information about a specific package, to where installation logs can be found, and how to list packages in other packager managers you might find.

Looking for information on Package management why not check these out?

Illustrated avatar of CJ Saathoff
Written by

CJ Saathoff

CJ Saathoff writes for the NameHero blog.

More from CJ →