How to List Installed Packages on Ubuntu Linux

This article provides detailed steps for listing all installed packages on Ubuntu Linux using the apt and dpkg-query package management tools. It highlights the importance of knowing installed packages when diagnosing vulnerabilities or replicating installations. Additionally, it discusses how to use filters for a more readable output, or count the total number of installed packages.

This post shows steps for students and new users to list all installed packages on Ubuntu Linux. Knowing which packages are installed on Ubuntu Linux can be important, especially when looking for vulnerable packages or building another machine. You want to install some packages on it.

There are multiple ways to view installed packages on Ubuntu Linux, and we’ll show you a few steps below that will list, count, and show currently installed packages.

Although this post is written for Ubuntu Linux, it should apply to other Debian-based Linux distributions using the apt package management tool.

Also, for students and new users learning Linux, Ubuntu Linux is the easiest place to start learning. Ubuntu is the modern, open-source Linux operating system for desktops, servers, and other devices.

Ubuntu is a great Linux operating system for beginners.

To start listing installing packages on Ubuntu Linux, follow the steps below.

How to list packages with apt on Ubuntu Linux.

apt is a command-line tool to manage packages on Ubuntu Linux. This tool installs removes, and performs other package-related tasks on Ubuntu Linux. You can use it to list installed packages as well.

Run the commands below to see all the installed packages on Ubuntu Linux using apt.

sudo apt list --installed

When you run the commands above, it will list all installed packages, including information about the package’s versions and architecture.

Listing... Done
accountsservice/focal-updates,focal-security,now 0.6.55-0ubuntu12~20.04.4 amd64 [installed,automatic]
acl/focal,now 2.2.53-6 amd64 [installed,automatic]
acpi-support/focal,now 0.143 amd64 [installed,automatic]
acpid/focal,now 1:2.0.32-1ubuntu1 amd64 [installed,automatic]
adduser/focal,focal,now 3.118ubuntu2 all [installed,automatic]
adwaita-icon-theme/focal-updates,focal-updates,now 3.36.1-2ubuntu0.20.04.2 all [installed,automatic]
aisleriot/focal,now 1:3.22.9-1 amd64 [installed,automatic]
alsa-base/focal,focal,now 1.0.25+dfsg-0ubuntu5 all [installed,automatic]
alsa-topology-conf/focal,focal,now 1.2.2-1 all [installed,automatic]
alsa-ucm-conf/focal-updates,focal-updates,now 1.2.2-1ubuntu0.10 all [installed,automatic]

If the list of installed packages is long, you can pipe the output to less to make it easy to read and create a page break. Press the space bar to move to the next screen.

sudo apt list --installed | less

How to list packages with dpkg-query on Ubuntu Linux

One can also use the pkg-query command to list installed packages on Ubuntu. If the way the list is formatted with the apt command isn’t adequate, you can use the dpkg-query command.

Run the commands below to list installed packages using the dpkg-query command.

sudo dpkg-query -l

You can also pipe the command to less to create and make it easier to read, as above.

sudo dpkg-query -l | less

You should see a similar list as the one below.

||/ Name                                       Version                               Architecture Description
+++-==========================================-=====================================-============-=====================>
ii  accountsservice                            0.6.55-0ubuntu12~20.04.4              amd64        query and manipulate >
ii  acl                                        2.2.53-6                              amd64        access control list ->
ii  acpi-support                               0.143                                 amd64        scripts for handling >
ii  acpid                                      1:2.0.32-1ubuntu1                     amd64        Advanced Configuratio>
ii  adduser                                    3.118ubuntu2                          all          add and remove users >
ii  adwaita-icon-theme                         3.36.1-2ubuntu0.20.04.2               all          default icon theme of>

The pkg-query list is formatted appropriately, as you can see above.

If you want to be a little fancy, you can count the number of packages installed by running the commands below.

sudo dpkg-query -f '${binary:Package}\n' -W | wc -l

The command above should output several packages installed on Ubuntu.

That should do it!

Conclusion:

  • Listing installed packages on Ubuntu Linux is essential for system management and security.
  • Both the apt and dpkg-query commands provide efficient ways to view installed packages.
  • Using the less command with either of these commands makes it easier to navigate long lists.
  • The ability to count installed packages helps assess the system’s complexity and manageability.
  • Knowing how to list installed packages is a fundamental skill for students and new users learning Linux.
Richard Avatar

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *