Linux-based systems use client applications to help in package management. Although some software packages are preinstalled by default, Linux users can install other packages when needed.
2. Using apt Package Manager
apt is a command-line tool that works with Advanced Packaging Tool (APT) in Debian-based systems, such as Ubuntu. It is used to install new software packages, upgrade existing software packages, update the package list index, and upgrade the entire Ubuntu system.
2.1. List Installed Packages
We use the ––installed tag to only list the installed packages.
$ apt list --installed | head WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Listing... accountsservice/now 0.6.55-0ubuntu12~20.04.4 amd64 [installed,upgradable to: 0.6.55-0ubuntu12~20.04.5] 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] ...
Installed packages have either of these three tags; [installed],[installed,automatic] and [installed,local]
- [installed] – shows that the software package was installed manually from the repository list
- [installed,automatic] – indicates that the software package was installed automatically as a dependency for another software package
- [installed,local] – shows that the software package is not from the official repository list
2.2. List Packages
We use the apt list command to list all the installed and available packages.
$ apt list | head WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Listing... 0ad-data-common/focal,focal 0.0.23.1-1 all 0ad-data/focal,focal 0.0.23.1-1 all 0ad/focal 0.0.23.1-4ubuntu3 amd64 0install-core/focal 2.15.1-1 amd64 0install/focal 2.15.1-1 amd64 0xffff/focal 0.8-1 amd64 2048-qt/focal 0.1.6-2build1 amd64 2ping/focal,focal 4.3-1 all 2to3/focal,focal 3.8.2-0ubuntu2 all
The output of the apt list command is very long. We pipe it to the head command to only list the first ten lines.
2.3. List Specific Package
We add the package name to the apt list command to list a specific package.
$ apt list python3 --installed Listing... Done python3/focal,now 3.8.2-0ubuntu2 amd64 [installed,automatic]
We list the details of the package, python3.
3. Using dpkg Package Manager
dpkg is a package manager for Debian-based systems.
To list the installed packages on our system:
$ dpkg --get-selections | grep -w "install" | head accountsservice install acl install acpi-support install acpid install adduser install adwaita-icon-theme install aisleriot install alsa-base install alsa-topology-conf install alsa-ucm-conf install
The ––get-selections gets a list of package selections and writes the output to stdout. We can pipe this output to the grep command, which selects the lines that match the word “install”. The head command helps trim the output by displaying the first 1o lines of the output.
Another way is to use the dpkg-query tool. This tool queries the dpkg database.
$ dpkg-query -l | head ii accountsservice 0.6.55-0ubuntu12~20.04.4 amd64 query and manipulate user account information ii acl 2.2.53-6 amd64 access control list - utilities ii acpi-support 0.143 amd64 scripts for handling many ACPI events ii acpid 1:2.0.32-1ubuntu1 amd64 Advanced Configuration and Power Interface event daemon ii adduser 3.118ubuntu2 all add and remove users and groups ii adwaita-icon-theme 3.36.1-2ubuntu0.20.04.2 all default icon theme of GNOME (small subset) ii aisleriot 1:3.22.9-1 amd64 GNOME solitaire card game collection ii alsa-base 1.0.25+dfsg-0ubuntu5 all ALSA driver configuration files ii alsa-topology-conf 1.2.2-1 all ALSA topology configuration files ii alsa-ucm-conf 1.2.2-1ubuntu0.5 all ALSA Use Case Manager configuration files
The -l option lists all the packages installed on our system.
4. Using snap Package Manager
snap is an alternative package manager in Linux developed by Canonical.
The snap list command lists all the packages installed using snap.
$ snap list Name Version Rev Tracking Publisher Notes core 16-2.54.4 12834 latest/stable canonical* core hello-world 6.4 29 latest/stable canonical* -
5. Using dnf Package Manager
dnf is intended to be a replacement for the yum package manager on Red Hat-based systems.
To list the installed packages on our system using dnf:
$ dnf list installed Installed Packages acl.x86_64 2.2.53-1.el8 @anaconda audit.x86_64 3.0-0.10.20180831git0047a6c.el8 @anaconda audit-libs.x86_64 3.0-0.10.20180831git0047a6c.el8 @anaconda
6. Using flatpak
flatpak is a package management software that is used to distribute software across various Linux distributions.
To view all the installed flatpak applications on our system:
$ flatpak list --app Name Application ID Version Branch Installation Fondo com.github.calo001.fondo 1.3.8 stable system Flatseal com.github.tchx84.Flatseal 1.5.2 stable system GNOME Boxes org.gnome.Boxes 3.36.6 stable system
In this tutorial, we saw how to use the apt command to list all the installed and available packages in Linux. We also learned how to use dpkg, dpkg-query, snap, dnf, and flatpak to list the installed packages.