How to List Installed Packages on Ubuntu 22.04?


Ubuntu packages are installed from the core libraries and local/external repositories. The packages from all these repositories are installed using different package managers. Whenever users install Ubuntu (or any other Linux distribution), they have to install packages to carry out various operations on the system.

Have you ever tried looking for the installed packages on Ubuntu?

This post will elaborate on the potential methods/approaches to list the installed packages on Ubuntu 22.04.

Let’s start with the primary purpose of the guide.

How to List Installed Packages on Ubuntu 22.04?

Ubuntu supports multiple package managers, including the apt, dpkg, snap, and flatpak. The apt and dpkg are interlinked package managers used by the Debian/Ubuntu-based systems. However, the Snap and flatpak packages are widely supported by all the renowned Linux distributions, including Ubuntu.

How to List the apt Based Packages on Ubuntu 22.04?

The apt is the most used package manager to install the packages from the core libraries of Ubuntu. The packages are listed with apt using the “apt list” command. The “apt list” command has various options, which are discussed below specifically to list the installed packages:

  • List the Installed Packages Only

This command will list only the installed packages on Ubuntu that the apt package manager recognizes. These packages also refer to the core libraries and the external repositories supported by Ubuntu:

$ apt list --installed

In the Output, you will get four types of installations, which are:

  • Installed, local: These packages are installed locally by downloading the Debian package file and then installing them using the dpkg i or apt install commands.
  • Installed, automatic: These are installed automatically with any other package (as of dependency).
  • Installed: These packages are installed manually by specifying the name of the package from the core libraries or the external repositories.
  • Installed, Upgradeable to: These packages are installed and are upgradeable to the latest version available. The available version is also listed with the “upgradeable to” option.
  • List Installed Packages That Match a Pattern

The “apt list –installed” when used with the Pipe operator, and the “grep” lists all the packages that contain that pattern. Let’s use “jammy-updates” as a pattern search as follows:

$ apt list --installed | grep jammy-updates

The output has listed all the packages with the pattern “jammy-updates” in their names.

  • List the Package(s) of the Exact Match/Same Name

If the “apt list –installed” command is given the package name, it will list only the installed package with the same name. Let’s practice it on the package name, i.e., remmina:

$ apt list --installed remmina

Note: By using the option “-a” with the above command, you will get the list of installed and available packages (if any, with the same name).

  • List the Installed and Available Packages

If the “apt list” command is used without any options, then it will list the installed along with the available packages from the core libraries (which are managed by the apt):

$ apt list

If the packages are installed, they would be marked as [installed], [installed, automatic], [installed, local], or [installed, upgradeable to] options. Rest all the packages are just available and have not been installed yet.

  • List the Details of a Specific Package

Apart from “apt list,” the “apt show” command also lists the details of a specific package, including the dependencies and the information about the installed version.

$ apt show remmina -a

The output shows the packages installed as it has displayed the installed size in the output.

 

How to List the dpkg-Based Packages on Ubuntu 22.04?

The “dpkg” command is used to manage the local packages and only locally installed packages are listed. The packages installed using the “dpkg” can be listed using the “apt” command. However, the “dpkg” command can explicitly list these packages. Here are the possible ways:

  • Using “dpkg –get-selections” Command

The “dpkg –get-selections” command will list the installed or de-installed programs on/from Ubuntu as can be seen below:

$ dpkg --get-selections

However, if we use the “|” and the “grep -w install” option, then it will show the installed programs as seen in the following command:

$ dpkg --get-selections | grep -w install

Now, only the installed packages are listed. There is another dpkg-based command that also fetches the installed packages.

  • Using the “dpkg-query” Command

The “dpkg-query” command accesses the dpkg database (where the details of the locally installed packages are available). Here’s the command that lists the locally installed packages:

$ dpkg-query --list

A list of all the locally installed packages is displayed alongside the package name, version, architecture, and description. Apart from that, the users can search for the specific package using the “dpkg-query –list” command as well by specifying the name of the package as follows:

$ sudo dpkg-query --list apparmor

Now, only the package that is specified is listed.

 

How to List the Installed Snap Packages on Ubuntu 22.04?

Snap is the Linux-wide package manager offering tens of packages/apps that can be installed on various Linux distributions. Unlike apt and dpkg, Snap is supported by almost all Linux distributions. The packages installed using the snap command (from snap store) can be listed using the command:

$ snap list

 

How to List the Installed Flatpak Packages on Ubuntu 22.04?

Flatpak is the container of applications used to install them on Ubuntu (and other Linux distros). The builds and the installation process of flatpak is different from any other method used on Linux distributions. The packages installed from Flatpak can only be listed using the “flatpak list –app” command as shown below:

$ flatpak list --app

Right now, only one package is installed using flatpak. If there are none, you will get no results.

 

Additional Commands to Filter the Output of the Above Methods

There are a few generic commands, such as grep, wc, or the redirection operator (>), that can be used to filter the output of the above commands. Each of the operators/commands has a specific purpose while using other commands. Let’s see how they are used:

  • Count the Number of Installed Packages

The “wc” command counts the number of items from the command’s output. The “wc” is utilized with the “Pipe” operator and can be used with any of the above commands for listing the installed package(s). Let’s say we use it with the apt “list –installed” COMMAND:

$ apt list --installed | wc

The apt has a list of 1687 installed packages.

  • Save the List of Installed Packages in an External File

The redirection operator is used to get the output of any command into any external file. The redirection operator is denoted by the “>” (angle bracket) in Linux/Ubuntu and can be used with any of the above commands for listing the installed packages. As an example, we used “>” with the command “dpkg-query –list” as follows:

$ dpkg-query --list > linuxgenie.txt

The successful execution ensures the list of installed packages retrieved using the “dpkg-query –list” command is now saved into the file named, “linuxgenie.txt”.

 

How to List the Installed Packages Using the Ubuntu Software Centre?

Ubuntu software center is the GUI support of the packages available across various core libraries of Ubuntu.

Launch/Open the Ubuntu Software and navigate to the “Installed” section, as directed below:

The list of installed packages is displayed via the Ubuntu Software Centre.

 

Bonus Tip: How to List Installed Packages on Other Linux Distros?

Until now, we have learned how to get the list of installed packages only on Ubuntu. What about other Linux distributions? We have the methods to get the installed packages on other Linux distributions. Let’s start with the RHEL/CentOS/Fedora-based distributions first:

For RHEL/CentOS/Fedora-Based Distributions

The RHEL/CentOS/Fedora-based Linux distributions support yum, dnf, or rpm to install packages from the local/external repositories. However, support for Snap and flatpak is also available to install/manage the Snap and flatpak-based packages. Let’s have a look at these:

  • Using the yum/dnf Commands

If the package manager is yum or dnf (same as the apt on the Debian/Ubuntu-based distributions), you can use the following command to list the installed packages:

$ yum list installed #For yum
$ dnf list installed #For dnf
  • Using the rpm Command

The working of rpm is the same as of dpkg in Debian-based systems. It is used to install the packages locally. The packages installed using the rpm command can be listed as follows:

$ rpm -qa

For Arch-Based Distributions

Arch-based distributions have the pacman as the official package manager (as apt). The packages installed with the pacman manager can be listed using the command:

$ pacman -Q

For OpenSUSE-Based Distributions

The zypper is the package manager used to install the packages on OpenSUSE-based distributions. The packages installed using the zypper package manager can be listed using the following zypper command:

$ zypper search --installed-only

Bottom Line

The list of installed packages on Ubuntu is retrieved using the apt, dpkg, snap, and flatpak commands. The selection of the command depends on which packages users want to retrieve. For instance, the packages installed from core libraries are fetched using the apt command. Similarly, the list of locally installed packages is obtained using the dpkg utility. Moreover, the snap and flatpak command refers to the packages/applications installed from the snap and the flatpak store.

This post has presented the possible methods (as per the categories of the installed packages) to list installed packages on Ubuntu 22.04.

Print Friendly, PDF & Email
Categories