How to List Installed Packages on CentOS

By 

Updated on

3 min read

List Installed Packages with yum and rpm on CentOS

In this tutorial, we will show you how to list and filter installed packages on CentOS. Knowing how to list installed packages on your CentOS system can be helpful in situations where you need to install the same packages on another machine or if you want to re-install your system.

We will also show you how to check whether a specific package is installed, count installed packages, and find out the version of an installed package.

List Installed Packages with Yum

YUM (Yellow dog Updater,) is the default CentOS package manager. It can be used to download, install, remove, query, and managing CentOS RPM software packages from the official and third-party CentOS repositories.

To list the installed packages on your CentOS system with yum, use the following command:

Terminal
sudo yum list installed

It will print a list of all installed packages, including information about the versions and repository of the RPM packages.

List installed packages with yum

Usually, the packages list is long, for better readability it is a good idea to pipe the output to less :

Terminal
sudo yum list installed | less

To find out whether a specific package is installed, filter the output with the grep command.

For example, to find out if the unzip package is installed on the system you would run:

Terminal
sudo yum list installed | grep unzip
output
unzip.x86_64    6.0-19.el7    @anaconda

The output above shows that unzip version 6.0-19 is installed on the machine.

List Installed Packages with Rpm

The rpm command with the -q option allows you to query the packages.

The following command will list of all installed packages:

Terminal
sudo rpm -qa

To query (search) whether a certain package is installed pass the package name to the rpm -q command. The following command will show you whether the tmux package is installed on the system:

Terminal
sudo rpm -q tmux

If the package is installed, you will see something like this:

output
tmux-1.8-4.el7.x86_64

Otherwise, the command will print:

output
package tmux2is not installed

To get more information about the queried package pass -i:

Terminal
sudo rpm -qi tmux

Create a List of all Installed packages

To create a list of the names of all installed packages on your CentOS system and save it in a file named packages_list.txt, redirect the command output to the file:

Terminal
sudo rpm -qa > packages_list.txt

To install the same packages on another server you can use the cat command to pass all packages to yum:

Terminal
sudo yum -y install $(cat packages_list.txt)

Count the number of installed packages

To find out how many packages are installed on your system, use the same command as before but instead of redirecting the output to a file, pipe it to the wc utility to count the lines:

Terminal
sudo rpm -qa | wc -l
output
603

The output above shows that there are 603 packages installed.

Conclusion

In CentOS systems you can list installed packages using the yum list installed and rpm -qa commands.

Feel free to leave a comment if you have any questions.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page