How to List the Installed Packages on Linux

52748640582_101162ee7f_o-7292187

To list installed packages on Ubuntu or any Debian distro, run “apt list –installed” in the Terminal. Run “dnf list installed” to list installed packages on Fedora.

With thousands of free Linux applications, it’s easy to lose track of what you once installed but no longer use. Here’s how to list the installed applications on the major Linux families, and a few methods that don’t depend on your Linux distribution.

What Are Packages on Linux Systems?

Packages on Linux are similar to apps or program installers on macOS and Windows—broadly speaking. They come bundled in an archive file that you typically download from a central repository. Different Linux distributions use different formats to deliver these files to you — Debian and Ubuntu use DEB files, for example, while RHEL and Fedora use RPM files.

Packages aren’t necessarily complete, precompiled programs, however. Sometimes they’re libraries, which provide important functionality to other applications on your PC.

Packages are typically installed, updated, and removed using a package manager. The package manager will also try to grab any dependencies when you install an application, too, so you don’t need to manually hunt down every single piece of code any given application requires to operate.

There are a few major package managers that you’ll commonly encounter. Red Hat-derived distributions (like Fedora) use the dnf package manager, Debian-derived distributions (like Ubuntu) use apt, and Arch-based distributions use pacman. There are also a few distribution-agnostic package managers like Snap and Flatpak that you can use on most any Linux system.

Apt: List Installed Packages on Ubuntu

The apt command allows you to use the package manager for the Debian distribution and the many distributions that have sprung from it, including Ubuntu.

Note: Apt is the replacement for the older apt-get command. Aptand apt-getshare most of their syntax, so if you find instructions that call for apt-get, you can usually substitute apt without any issue.

To see the list of installed packages, use this command:

apt list --installed

6-2-7702528

As expected, the output is long and scrolls past quickly.

7-1-2173705

To see how many entries there are, we can pipe through wc, as we did before.

apt list --installed | wc -l

8-1-9116776

To find packages of interest, we can use grep and part of the name or topic we’re interested in.

apt list --installed | grep xfonts

10-1-3514280

To investigate a single package, use the apt show command with the name of the package.

apt show xml-core

9-1-1960880

 

DNF: List Installed Packages on Fedora

Fedora is the most successful of the RedHat-derived desktop distributions. We’ll use that to discuss listing installed applications with the dnf package manager.

To list the installed packages with dnf, run the following command:

dnf list installed

1-3-8764787

This produces an avalanche of information.

2-2-4799155

To see how many packages were listed, we can pass the output through wc, with the -l (lines) option.

3-3-7022246

This tells us dnf found 1,968 installed packages. To make the output more manageable you could pipe it into grep, and search for packages of interest.

dnf list installed | grep terminal

4-1-9396318

You could also pipe the output into less and use the search function within less to find what you are looking for.

If you see a package in the list that you want to know more about—which is a good idea if you’re considering removing it—you can use the dnf info command.

You need to provide the name of the package without the platform architecture details. For example, to see the details of the package “gnome-terminal.x86_64” you’d type:

dnf info gnome-terminal

5-2-1408471

Pacman: List Installed Packages on Arch

The pacman package manager is used on Arch Linux and its derivatives, such as Manjaro and EndeavourOS.

To list packages using pacman we need to use the -Q (query) option.

pacman -Q

11-1-3928209

The list of packages is displayed in the terminal window.

12-1-7786416

Installing a single application is likely to cause multiple packages to be installed, because of unmet dependencies. If the application requires a particular library and it isn’t present on your computer, the installation will provide it. Similarly, uninstalling an application can cause several packages to be removed. So the number of applications isn’t the same as the number of packages.

To count the installed packages, we pipe the output through wc and use the -l (lines) option, as before.

pacman -Q | wc -l

13-1-9390847

The -i (info) option lets us look at the details of a package.

pacman -Qi bash

14-1-3684872

Adding the -i option twice can provide a bit more information, if any is available.

pacman -Qii bash

15-1-5607570

In this case, there are some extra lines at the bottom of the listing that show where the “.bash_profile” and “.bash_logout” template files are located.

16-1-5316656

Flatpak: List Installed Packages on Any Distro

There are ways to install applications that are distribution agnostic. They’re designed to be universal package managers. They install sandboxed versions of apps, including any dependencies they have. This makes it easy to install different versions of an application without having to worry about incompatibilities or cross-contamination from version to version.

From the software developer’s perspective, using a universal package manager means they only have to package their application once and they’ve got all distributions covered.

The flatpak system is one of the two most popular universal installers. If you’ve used flatpak on your computer, you can still list the installed applications with the following command:

flatpak list

17-3256722

This lists the installed applications and the associated runtimes that have been installed to satisfy the dependencies of those applications. To see just the applications, add the --app option.

flatpak list --app

18-2476806

To see the details of an individual application, use the info command and the application ID of the package, not the application name.

flatpak info org.blender.Blender

19-8456986

Snap: List Installed Packages on Any Distro

The other popular universal package manager is called snap. It is a Canonical initiative. It is used by default in the Ubuntu Software application on recent Ubuntu releases and snap can be installed on other distributions too.

To list the applications that have been installed using snap, use this command:

snap list

20-5203221

To see the details for a single application, use the snap info command and the name of the application.

snap info firefox

21-7791565

Why Check Installed Packages and Applications?

The choice of free and open-source applications available to Linux users is astonishing. For a newcomer to Linux it can be overwhelming. But it’s also part of the fun. If you have a particular need, you search for a piece of software to address that need. If you don’t get along with the one you find, that’s no problem. There are likely to be dozens more that you can try until you find one that ticks all of your boxes.

If you’re not scrupulous about uninstalling the ones you know you won’t use, they’ll sit in your system using up hard drive space. If you’re a programmer you’ll also have unused toolkits and libraries dotted around your computer. On a desktop computer, with today’s reasonably cheap, high-capacity drives, that might not in itself be too much of a problem. On laptops, it is more of a concern because of their smaller storage capacities.

But whether you have the hard drive space to spare or not, hoarding unused software means software updates will take longer because you’re updating all of those unused applications along with the ones that you actually do use. System images and other backups will be larger than necessary, will take longer to complete, and will consume more backup media.

There’s also the possibility of incompatibilities between components of installed and forgotten applications and new ones you try to install.

In order to manage the situation, the obvious first step is to find out what is installed. Once you know what, you can review the list and decide what stays and what goes.

Make Informed Decisions

dnf, apt, and pacman have options that automatically find and delete orphaned and unneeded packages. But they won’t find old packages that you just don’t use anymore. That requires human intervention and the knowledge of what requires uninstalling. That’s where these handy commands come in.

Original Article