Linux

How to list installed packages in Linux

In this tutorial, we will show you various methods and techniques you can use to view the list of installed packages using various package management systems, including apt, dnf, dpkg, snap, and yum.
Captain Salem 5 min read
How to list installed packages in Linux

Package management is one of the most common operation for any Linux users. Although Linux does come pre-installed with a suite of good and useful tools, you will encounter yourself installing custom packages on your system.

APT List Installed Packages

Advanced Packaging Tool, or APT, is a command-line utility that allows you to install, uninstall, update and manage packages on Debian based systems. It is one of the most popular packages in Debian systems such Ubuntu, Linux Mint, !Pop OS, etc.

To list installed packages on Debian systems using apt, run the comand as shown:

sudo apt list --installed

The command should list all the packages installed on the target system.The command may contain a lot of output. You can pipe the output to other tools such as grep, less or head.

For example, to show the first 10 packages, run the command:

sudo apt list --installed | head -10

Output:

Listing...
adduser/stable,now 3.118 all [installed]
apt-utils/stable,now 2.2.4 amd64 [installed]
apt/stable,now 2.2.4 amd64 [installed]
base-files/now 11.1+deb11u3 amd64 [installed,upgradable to: 11.1+deb11u5]
base-passwd/stable,now 3.5.51 amd64 [installed]
bash/now 5.1-2+b3 amd64 [installed,upgradable to: 5.1-2+deb11u1]
bsdutils/stable,stable-security,now 1:2.36.1-8+deb11u1 amd64 [installed]
ca-certificates/stable,now 20210119 all [installed,automatic]
coreutils/stable,now 8.32-4+b1 amd64 [installed]

The output above includes other details such as the state under which the package was installed:

  1. installed - this indicates that the package was installed manually by the user.
  2. installed,automatic - the package was instaled automatically as a dependency.
  3. installed,local - the package was installed via local method and not from official repository. An example would be a dpkg package.

Apt Show Specific Package Details

You can also pass the package name to the apt command to show the details about that package. An example is as shown:

sudo apt list curl -a --installed

Output:

Listing... Done
curl/bullseye-backports 7.85.0-1~bpo11+1 amd64
curl/stable,now 7.74.0-1.3+deb11u3 amd64 [installed]
curl/stable-security 7.74.0-1.3+deb11u2 amd64

DNF Show Installed Packages

Dandified YUM, or simply DNF, is the successor to the popular Yellowdog Updater, Modified package manager, more commonly known as YUM. It is a popular package manager in REHL systems such as RedHat Enterprise Linux, CentOS, Fedora, etc.

You can learn how to use DNF in the link below:

https://www.geekbits.io/dnf-package-manager-beginners-guide/

To show the installed packages in DNF, run the command:

dnf list installed | head -10

The command show list the top 10 installed packages on your system. An example output is as shown:

Installed Packages
NetworkManager.x86_64                1:1.39.7-2.el9             @anaconda
NetworkManager-libnm.x86_64          1:1.39.7-2.el9             @anaconda
NetworkManager-team.x86_64           1:1.39.7-2.el9             @anaconda
NetworkManager-tui.x86_64            1:1.39.7-2.el9             @anaconda
PackageKit.x86_64                    1.2.4-2.el9                @koji-override-1
PackageKit-glib.x86_64               1.2.4-2.el9                @koji-override-1
abattis-cantarell-fonts.noarch       0.301-4.el9                @koji-override-1
acl.x86_64                           2.3.1-3.el9                @anaconda
adobe-source-code-pro-fonts.noarch   2.030.1.050-12.el9.1       @koji-override-1

This shows the installed package, version and the source.

DPKG Show Installed Packages

Another common package manager for Debian systems is DPKG.

To show installed packages with dnf, run the command:

dpkg --get-selections | grep -w "install" | head -10

In this case, we use the --get-selections parameter to show the list of package selections to standard out. We then pipe the output to grep to filter for the installed packages.

An example output is as shown:

adduser                                         install
apt                                             install
apt-utils                                       install
base-files                                      install
base-passwd                                     install
bash                                            install
bsdutils                                        install
ca-certificates                                 install
coreutils                                       install
cpio                                            install

If you do not wish the above command chaining, you can use the dpkg-query command for similar operation.

The command is as shown:

dpkg-query -l

The command should display detailed information about the installed packages, including description and architecture.

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                       Version                        Architecture Description
+++-==========================-==============================-============-===============================================================================
ii  adduser                    3.118                          all          add and remove users and groups
ii  apt                        2.2.4                          amd64        commandline package manager
ii  apt-utils                  2.2.4                          amd64        package management related utility programs
ii  base-files                 11.1+deb11u3                   amd64        Debian base system miscellaneous files
ii  base-passwd                3.5.51                         amd64        Debian base system master password and group files
ii  bash                       5.1-2+b3                       amd64        GNU Bourne Again SHell
ii  bsdutils                   1:2.36.1-8+deb11u1             amd64        basic utilities from 4.4BSD-Lite
ii  ca-certificates            20210119                       all          Common CA certificates
ii  coreutils                  8.32-4+b1                      amd64        GNU core utilities
ii  cpio                       2.13+dfsg-4                    amd64        GNU cpio -- a program to manage archives of files
ii  cron                       3.0pl1-137                     amd64        process scheduling daemon
ii  curl                       7.74.0-1.3+deb11u3             amd64        command line tool for transferring data with URL syntax
ii  dash                       0.5.11+git20200708+dd9ef66-5   amd64        POSIX-compliant shell
ii  debconf                    1.5.77                         all          Debian configuration management system
ii  debconf-i18n               1.5.77                         all          full internationalization support for debconf

Snap Show Installed Packages

Snap is a package manager developed by Canonical by use with Ubuntu systems and supported systems. To show installed packages with snap, run the command:

snap list

The command should show all installed packages.

Name    Version        Rev    Tracking       Publisher   Notes
core20  20220826       1623   latest/stable  canonical✓  base
lxd     4.0.9-8e2046b  22753  4.0/stable/…   canonical✓  -
snapd   2.57.2         17029  latest/stable  canonical✓  snapd

Pacman Show Installed Packages

Pacman is a package manager to Arch Linux and Arch based distributions. To show the installed packages using pacman, run the command:

pacman -Q

An example output is as shown:

acl 2.3.1-2
arch-install-scripts 24-2
archlinux-keyring 20220125-1
argon2 20190702-4
attr 2.5.1-2
audit 3.0.7-1
base 2-2
bash 5.1.016-1
brotli 1.0.9-7
bzip2 1.0.8-4
ca-certificates 20210603-1
ca-certificates-mozilla 3.75-1

Flatpak Show Installed Packages

flatpack is one of the popular universal package managers in the Linux systems. To show the installed packages with flatpack, run the command:

flatpak list

This should return information about the available packages.

Ending...

In this post, we discussed how to use various Linux package managers to show the list of available package managers.

We hoped you enjoyed this article. Leave a comment to let us know where we can make improvements.

Salute!!!

If you enjoy our content, please consider buying us a coffee to support our work:

Share
Comments
More from GeekBits

Join us at GeekBits

Join our members and get a currated list of awesome articles each month.

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to GeekBits.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.