How To List Installed Packages in Linux Using Package Management

We all know Linux is a kernel, not an Operating System like
Windows 10. Many vendors use the Linux kernel to create various
distributions like Ubuntu, Debian, SuSE. Different OS has its own
GUI like Ubuntu has gnome, and SuSE has KDE. But remember, the base is always
the Command Line Interface (CLI), which is faster than GUI. The
reason why the command-line interface is most popular and useful
among the Linux users is it doesn’t require more system memory and
CPU. In Linux, software packages are installed and stored in the
system repository. Using different terminal shell commands, we can
check and create a list of installed packages in different Linux
operating systems. [1][2]

Why Do We Prefer the Package
Manager?


The package manager’s advantage is that if we want to install a
program manually using the Graphical User Interface method of
package installation, we have to ensure that the configuration is
set and all the required dependencies are up-to-date on the
computer. But the package manager does this automatically, so you
do not have to worry about the configuration settings or the
dependencies for installing a particular program.

All you have to do is, run a single command and then install the
program on your computer. In Linux, the Package manager can be used
to install applications and find out installed packages inside the
machine. In this post, we are going to learn how to generate an
index of installed packages in most used Linux distros.


Different Linux distro uses various tools and methods to install
packages inside the system. Here is the list of command-tools that
we will use in this post to create the list of installed packages
on various Linux distributions. We will see some essential commands
for Debian, Red Hat Linux Enterprise, Fedora, SuSE, and Arch
Linux.

  • Red Hat Linux or CentOS uses the yum tool in
    .rpm format.
  • Fedora, Red Hat, and CentOS uses the dnf tool in
    .rpm format.
  • SuSE uses RPM, but it also uses its own package
    tool called zypper.
  • Arch Linux uses the pacman command.
  • Debian and Ubuntu use apt and dpkg
    tools in .deb format.

1. List Installed Packages using the RPM
Command


RPM stands for Red Hat Package Manager, but it is also
used in other distributions like CentOS, Fedora, and SuSE.

RPM has its own arrangements to get the list of installed packages
and their files. By using the RPM command, you can
create a list and sort the name of installed packages. You can also
export a text file that will carry all the names of installed
packages on your Linux system.

Enable the Query to List Package Names:

$ rpm -qa --last

Summarize the List of Installed Packages on
RPM-based Systems:

$ rpm -qa --last |wc --l

List Installed Packages in Linux Using Package Management rpm

Export a List of Installed Packages to a Text File on
RPM-based Systems:

 $ rpm -qa --last > packages.txt

2. List Installed Packages using the YUM
Command


YUM (Yellow Updater Modified) is an open-source GUI based
command-line interface system specifically use for installing,
removing, updating, and running queries on Red Hat Linux and
CentOS. The yum command works based on the method of
server-client architecture.

We can use the yum commands to prepare a list of
installed packages, get detailed information and calculate the
total number of installed packages in our Linux machine.

Create a List of Installed Packages:

$ yum list installed
$ yum list all

Get Detailed Information about
Packages:

$ yum info acl

Summarize the List of Installed Packages:

$ yum list installed | wc –l

3. List Installed Packages using the DNF
Command


DNF (Dandified Yum) is the upgraded version of the software
package manager for Red Hat, CentOS, and Fedora Linux. In 2013 it
was released on Fedora 18, but now it is also the default package
manager for RHEL 8 and CentOS 8 since 2015.

Since the DNF commands are quick and handy among the users, here
are some terminal commands to create a list of installed packages,
get detailed information about the packages, and calculate the
total number of installed packages on your system.

You can also create and export a text file that will include all
pieces of information about the installed packages. The text file
will be saved inside the home directory.

Create a List of Installed Packages:

$ dnf list installed

Get Detailed Information about Packages:

$ dnf info tilix

Calculate the Total Number of Packages Installed in Your
System:

$ dnf list installed | wc –l

Export a List of Installed Packages:

$ dnf list installed > packages.txt

4. List Installed Packages using the
Zypper Command


Zypper is the package management tool in Open SuSE and SuSE
Linux. It is a command-line package manager that uses the libzypp[3]
library for software installation. The zypper can be
used to manage the software repository by performing the
installation, removing, and updating packages through the
command-line interface.

It can also perform some primary query commands to list
installed packages on your Linux system. Here, some basic
zypper commands are given to get a list of installed
packages inside your SuSE Linux.

Create a List of Installed Packages:

$ zypper se --installed-only

Get Detailed Information about Packages:

 $ zypper info nano

Calculate the Total Number of Packages Installed in Your
System:

$ zypper se --installed-only | wc –l

Export a List of Installed Packages:

$ zypper se --installed-only > packages.txt

5. List Installed Packages using the
Pacman Command


Pacman (Package Manager) is the default command-line package
manager tool for Arch Linux systems and its derivatives like
ArcoLinux, Manjaro, Chakra, and many more. It uses the libalpm library of Linux, which allows
us to install, remove, build, and manage Arch Linux packages.
[4]

At the very beginning, we can run a query command
(-Q) to check the package list. Then we will be able
to get detailed information and calculate the total number of
installed packages on our Linux system.

Create a List of Installed Packages:

 $ pacman -Q

Get Detailed Information about Packages:

$ pacman –Qi bash

Calculate the Total Number of Packages Installed in Your
System:

$ pacman -Q | wc –l

Export a List of Installed Packages:

$ pacman -Q > packages.txt

6. Create a List of Installed Packages using the
DPKG Command


Dpkg (Debian Package) is a low-level package manager tool for
Debian-based systems like Ubuntu, Linux mint. The dpkg
command is mostly used to manage the Debian packages. But sometimes
the Debian Package installer is not good enough to grab the
essential repository files instantly.

Even it is not recommended to remove packages using the
dpkg tool due to dependency issues. However, you can
use the dpkg command to generate and export a record
of installed packages on your Ubuntu Linux.

Get the Build Information of Installed
Packages:

$ dpkg -l

list package in linux dpkg -l

Calculate the Total Number of Packages Installed in Your
System:

$ dpkg --list | wc --lines

Export a List of Installed Packages:

$ dpkg -l > packages.txt

7. Get the Lists of Installed Packages using the
Apt Command


APT stands for Advanced Package Tool, it is a high-level
command-line software manager for Debian-based systems like Ubuntu,
Linux mint. It can be used to find and install new packages,
upgrade packages, remove the packages, and can deal with dependency
issues.

You can use the apt command tool to create an index
of installed packages on your Linux machine. You can also export a
text file that will include all the pieces of information about the
installed packages on your Debian Linux. The text file is usually
stored in the home directory.

Get a List of Installed Packages on Your Debian
System:

$ apt list –installed
$ sudo apt list --installed | less
$ apt list

Installed Packages in Linux apt list

Check Detailed Information of Any Specific
Package:

$ apt show firefox

apt show list firefox

Calculate the Total Number of Packages Installed Inside
the System:

$ apt list –installed | wc –l

Export a List of Installed Packages to a Text File using
an APT command:

$ apt list –installed > packages.txt

Final Words


That’s it, everyone, you have learned the overview of basic
operations of how to generate a list of installed packages on your
Linux distro using package management. I have characterized the
fundamentals of the shell commands[5]
for various Linux distributions. And, I have explained the process
of listing installed packages in Linux through the command-line
interface. I should mention that I’ve revealed why I prefer the
command-line interface (CLI) method instead of the graphical user
interface (GUI) method.

If you had been looking for a guideline to create a list of
installed packages on your Linux machine, I hope you find this post
helpful and handy. Please share it with your friends and your Linux
community. We also encourage you to write your opinions regarding
this post. Please write your comment in the comment segment.

References

  1. ^
    How to
    Customize Gnome Shell. Tips to Beautify Your Gnome Desktop

    (www.ubuntupit.com)
  2. ^
    KDE
    (www.ubuntupit.com)
  3. ^
    libzypp
    (doc.opensuse.org)
  4. ^
    libalpm
    (www.archlinux.org)
  5. ^
    40
    Simple Yet Effective Linux Shell Script Examples

    (www.ubuntupit.com)

Read more

Leave a Reply