How to List Installed Packages in Ubuntu 22.04

A “package” is a compressed file archive containing all the files that come with a particular application. Several examples of packages are .tgz, .deb, and .rpm.

Today, we will explore how to display the list of all the packages installed on our system. To do that, we have presented three different methods. We have used Ubuntu 22.04 to demonstrate the procedure. We will run easy-to-follow Linux commands on Ubuntu’s command line (Terminal) to list the packages.

Without any further ado, let’s get started!

Guide

Here are the three different methods we will use to display the list of all the packages installed on our Ubuntu system:

Method 1: List the Packages With the Help of the apt Command

In this method, we will see how to install packages on our system using apt. Apt is a packet manager that helps install, update, display, and remove packages on an Ubuntu system. To list down all the packages with the help of the apt command, execute the following command:

apt list --installed

Output:

The command printed the names of all the packages installed on our system using the apt command and .deb files. It also told us the installed versions and the architecture.

We can also use the grep command along with the apt command to see if a certain package is installed on our system or not.

 apt list --installed | grep package_name

Example:

 apt list --installed | grep xorg

Output:

To see information about a particular package, we can use the show command with apt like this:

 apt show package_name

Example:

 apt show xorg

Output:

Method 2: List Installed Packages With the Help of the dpkg Command

This method will show how we can use dpkg to list the packages. Dpkg is used to install, build, and remove packages in Debian OS and its derivatives. To list down the packages, execute the following dpkg-query command:

 dpkg-query -l

Output:

As you can see, the command printed the package names, installed versions, and architecture.

To see if a certain package is installed on your system, execute the following command followed by the package name:

 dpkg-query –l package name

Example:

 dpkg-query –l acl

Output:

Method 3: List Installed Snap Packages

To list down snap packages, we cannot use apt or dpkg commands. Instead, we use the snap command to display packages installed as snaps on our system.

To print all the packages installed as snap, issue the following command:

 snap list

Output:

The command displayed all the snap packages and their installed versions.

How To Count All the Installed Packages on Linux System

If we want to see the exact number of packages installed on our system, we can use the following command:

apt list --installed | grep -v "^Listing" | wc -l

Output:

The output tells us that we have a total of 1708 packages installed on our system.

Conclusion

In today’s guide, we discussed in detail how to list down all the packages installed on our system using three different methods. We first saw how to display the packages with the help of apt command. Then we used the dpkg command. We also saw how to display packages installed as snaps on our system. In the end, we also explored a basic Linux command to display the total number of packages installed on our system.



from https://ift.tt/8iwQHUX

Post a Comment

0 Comments