• About Us
  • Contact us
  • Disclaimer
  • Privacy Policy

Linuxtor

Linux Tips, Tricks and DevOps Tutorials

  • Home
  • Ubuntu
  • CentOS
  • Debian
  • Commands
  • DevOps
  • Series
You are here: Home / CentOS / How to List Installed Packages on CentOS

How to List Installed Packages on CentOS

February 11, 2022 by Asmita Leave a Comment

In this guide, I will show you how you can filter and list installed packages on CentOS. Whenever you install any packages on CentOS, it is advisable to know how to show installed packages. After checking out the same packages installed, you can decide whether or not to install older packages.

In this article, you will learn how to check which packages are installed, find out versions of installed packages and count installed packages on CentOS systems.

Table of Contents

  • 1 List Installed Packages with Yum on CentOS
  • 2 List installed packages with RPM
  • 3 Create a list of all installed packages
  • 4 Count the number of installed packages
    • 4.1 Conclusion

List Installed Packages with Yum on CentOS

In the CentOS, the package manager is identified as YUM (Yellow Dog Updater). Before typing any command in CentOS, you have to prefix it with YUM. The YUM package manager can be used to install, remove, download and update CentOS RPM software packages directly from official repositories as well as third-party repositories.

To list out the installed packages on the CentOS system using yum, you can use the following command.

sudo yum list installed

Here, we are using sudo to run the command as a root user privileges. The above command will output the list of all installed RPM packages of CentOS as well as information about the versions. Have a look at the screenshot below.

Normally, there are many default packages are available on the CentOS system. However, you can use less to display the readable output of the package list using the below command.

sudo yum list installed | less

To find out any specific packages on the system, you must filter the output using the grep command.

Let’s assume, we have to find out whether the unzip package is installed or not. In this case, we will use the following command.

sudo yum list installed | grep unzip

The output will be displayed as below.

unzip.x86_64 6.0-19.el7

You can see in the above output, the unzip version 6.0-19 is installed on the system.

List installed packages with RPM

1280px Centos logo light.svg
How to List Installed Packages on CentOS 1

The rpm command allows you to query the packages and list out the installed packages. To query the packages use -q option with rpm command.

sudo rpm -qa

To search whether or not certain packages installed on the system, simply write the package name with rpm -q command. See the command below to check tmux package is installed on CentOS or not.

sudo rpm -q tmux

If the tmux package is installed, then you will see an output as below.

tmux-1.8-4.el7.x86_64

If the package is not installed, it will output like…

package tmux2is not installed

Next, to get more information about the tmux package, type command as below.

sudo rpm -qi tmux

Create a list of all installed packages

There is a way to create a list of all installed packages on CentOS and then save it in text file separately. You just have to redirect the output of the command to the file using > operator.

sudo rpm -qa > packages_list.txt

To install the packages on the server you can use the cat command to pass the details to yum.

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

Count the number of installed packages

You can easily find out how many packages are installed on the system. To do that, we have to pie the command output to wc utility to count the lines.

sudo rpm -qa | wc -l

It will return the count of a number of the packages installed on the system.

Conclusion

In the CentOS systems, It is an easy process to list installed packages using the yum list installed command. Alternatively, the rpm -qa command is useful in counting the list of all packages and return the integer number.

Filed Under: CentOS, Commands Tagged With: terminal

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Linux Guides

  • Explain pkill command in Linux
  • Linux File Command, Explain with Syntax and Examples
  • Explain rm command in Linux with Examples
  • What is the /etc/shadow file in Linux
  • How to List Installed Packages on CentOS
  • How To Create a Sudo User in Ubuntu Linux

Read More On

  • CentOS
  • Commands
  • Ubuntu

What is Linuxtor?

Linuxtor.com is your education source to learn more about Linux, Shopify, DevOps and MEAN/MERN Stack development. We are a team of enthuasist pertaining to provide maximum possible guidance on or related to the Linux platform.

Explore about us

  • About Us
  • Contact us
  • Disclaimer
  • Privacy Policy

Copyright © 2023 All Rights Reserved Log in