Sep 19, 2023 3 min read

How to List Installed Packages on Ubuntu

List Installed Packages on Ubuntu with our step-by-step tutorial. An installed package is a software installed on a computer or device.

List Installed Packages on Ubuntu
Table of Contents

Introduction

Before we begin talking about how to list installed packages on Ubuntu, let's briefly understand – What is an Installed Package?

An installed package refers to a software program that has been installed on a computer or device. It contains a collection of files necessary for the program to function properly.

By installing packages, users can enhance the functionality of their devices. Installed packages can include applications, drivers, plugins, and libraries. These packages are often downloaded from trusted sources and installed using specific installation procedures.

Overall, installed packages allow users to optimize their devices by adding new features or improving performance.

Knowing how to list installed packages on your Ubuntu system can come in handy if you need to reinstall your system or need to install the same packages on another machine.

Despite the fact that this article is for Ubuntu, the same methods apply to any Ubuntu-based distribution, including Kubuntu, Linux Mint, and Elementary OS.

In this tutorial, you will list installed packages on Ubuntu. We will also address a few FAQs on how to list installed packages on Ubuntu.

List Installed Packages with apt

The package management system's command-line interface is known as apt. It was launched in Ubuntu 14.04 and combines the most regularly used commands from apt-get and apt-cache, as well as the ability to list installed packages.

Use the following command to see a list of installed packages on your Ubuntu system:

sudo apt list --installed

The program outputs a list of all installed packages, including information about their versions and architecture, as shown in the output above.

Because the package list is large, pipe the output to less, to make it easier to read:

sudo apt list --installed | less

The grep command can be used to filter the output to see if a specific package is installed. For example, to see if the screen package is present on our system, we may use the following command:

sudo apt list --installed | grep screen
Output

screen/bionic,now 4.6.2-1 amd64 [installed]

The information above indicates that our system is running screen version 4.6.2-1.

List Installed Packages with dpkg-query

If you're using an older version of Ubuntu, you can use the dpkg-query command to see what packages are installed:

sudo dpkg-query -l | less

The command displays a list of all installed packages, along with their versions, architecture, and a brief description.

You may use grep to filter the dpkg-query -l output just like the apt output:

sudo dpkg-query -l | grep package_name

Create a list of all installed packages

Run the following command to generate a list of all installed packages on your Ubuntu or Debian system and save it to a file named packages list.txt:

sudo dpkg-query -f '${binary:Package}\n' -W > packages_list.txt

Now that you have the list, you can use the following commands to install the same packages on your new server:

sudo xargs -a packages_list.txt apt install

Count the number of packages installed on your Ubuntu system

You may use the same command as before to find out how many packages are installed on your system, but instead of routing the output to a file, pipe it to the wc utility and count the lines:

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

470

As you can see, our Ubuntu server has 470 packages installed.

FAQs to List Installed Packages on Ubuntu

Can I view only the manually installed packages? 

Yes, you can view only the manually installed packages by running: apt-mark showmanual

How do I list packages installed from a specific repository? 

Run the command: apt list --installed | grep <repository-name>

Can I list packages by their size? 

Yes, use the command: dpkg-query -W --showformat='${Installed-Size}\t${Package}\n' | sort -n

How do I export the list of installed packages to a file? 

Execute: dpkg --list > installed_packages.txt

Can I get a list of dependencies for an installed package?

Yes, run: apt-cache depends <package-name>

How to update the list of installed packages? 

Run: sudo apt update to update the package list, then sudo apt upgrade to upgrade the installed packages.

How can I check if a package is installed on Ubuntu?

Use the command: dpkg -s <package-name>

Conclusion

We hope this detailed guide helped you to list all installed packages on your Ubuntu machine.

If you have any queries, please leave a comment below, and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.