How to List Installed Packages on CentOS with Yum or RPM

Introduction

If you are running a CentOS system, you may need to know what packages are installed on your system. This can be done using either the Yum or RPM package manager. Yum is the default package manager for CentOS, while RPM is an alternative package manager. In this tutorial, we will show you how to list installed packages on CentOS using both Yum and RPM. We will also provide some useful tips and tricks for managing packages on CentOS.

How to List Installed Packages on CentOS with Yum or RPM

1. List Installed Packages with Yum:

a. To list all installed packages on your CentOS system, run the following command:

$ sudo yum list installed

b. To list all available packages on your CentOS system, run the following command:

$ sudo yum list available

2. List Installed Packages with RPM:

a. To list all installed packages on your CentOS system, run the following command:

$ sudo rpm -qa

b. To list all available packages on your CentOS system, run the following command:

$ sudo rpm -qa –queryformat “%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n”

Introduction

Managing a CentOS operating system often means knowing the software packages that are installed. This list can be used for rolling out software updates, rebuilding an operating system, or even duplicating a work environment on another machine.

This guide provides three simple methods to list installed software packages on CentOS (and other RedHat-based Linux systems).

how to list installed packages on centos

Prerequisites

  • Access to a user account with sudo or root privileges
  • A terminal window or command line
  • The YUM and RPM package managers, included by default

How to List Installed Packages with YUM

YUM stands for Yellowdog Updater, Modified. It is an updated package manager that allows you to install, remove, update, view, or search software packages.

Use the following yum command  to display all installed packages:

sudo yum list installed

To check if a specific package is installed with YUM, filter the output with the grep command:

sudo yum list installed | grep xorg
terminal yum list packages command with grep

To display the details on a particular package with YUM:

yum info httpd
terminal with yum info command

YUM can also output the full package list to a file:

sudo yum list installed > listed_packages.txt

This file can be copied to another system to duplicate the installed packages:

sudo yum –y install $(cat listed_packages.txt)
  • The –y option answers yes to all installation prompts
  • The cat command concatenates the contents of the file into the yum install command

For more information on the yum command, use yum ––help.

List Installed Packages with RPM

RPM stands for RedHat Package Manager. It comes as standard with most Red-Hat-based Linux operating systems, such as CentOS and Fedora.

To display a list of installed packages, enter the following in a terminal window:

sudo rpm –qa
  • The –q option means query
  • The –a option means all

To list packages by installation date, enter:

sudo rpm –qa ––last

Search for a package by name using:

sudo rpm –qa | grep –i httpd

This command returns results for the Apache software.

Output the list of packages to a file by entering the following:

sudo rpm –qa > listed_packages.txt

This command saves a copy of the list in a text file called listed_packages.txt in the current working directory.

Display information about a particular package:

rpm –qi httpd
  • The –q option stands for query
  • The –i option stands for info

Count the total number of packages installed:

sudo rpm –qa | wc –l
  • The wc command creates a word count
  • The –l option counts the number of lines
terminal with rpm wc command

RPM lists packages by their package name and revision number. Text-wrapping can make this tool harder to read. Use the rpm ––help command for more options, or refer to the documentation.

List Installed Packages with yum-utils

Yum-utils is a software package that adds functionality to the standard YUM package manager.

To install the yum-utils software package enter:

sudo yum –y install yum-utils

List all installed packages with the repoquery command:

sudo repoquery –a ––installed

The yum-utils package uses yum repositories to pull information.

Conclusion

Now you understand how to list and filter installed packages on CentOS. This guide provided three methods (YUM, RPM, or yum-utils) for listing packages on YUM based Linux distributions.

If you want to find out more on RPM and YUM, read our article and find out how RPM and YUM differ.

How to List Installed Packages on CentOS with Yum or RPM

CentOS is a popular Linux distribution used by many organizations and individuals. It is based on Red Hat Enterprise Linux and is a great choice for those who need a reliable and secure operating system. One of the most important tasks when managing a CentOS system is to keep track of the installed packages. This can be done using either Yum or RPM.

Using Yum

Yum is the default package manager for CentOS. It is used to install, update, and remove packages from the system. To list all installed packages, use the following command:

yum list installed

This will list all packages that are currently installed on the system. You can also use the following command to list only packages from a specific repository:

yum list installed --disablerepo="*" --enablerepo="<repository>"

Replace <repository> with the name of the repository you want to list packages from.

Using RPM

RPM is an alternative package manager for CentOS. It is used to install, update, and remove packages from the system. To list all installed packages, use the following command:

rpm -qa

This will list all packages that are currently installed on the system. You can also use the following command to list only packages from a specific repository:

rpm -qa --qf "%{name}-%{version}-%{release}.%{arch} %{vendor}

\t%{installtime:date}

" --queryformat="%{name}-%{version}-%{release}.%{arch} %{vendor}

\t%{installtime:date}

" --repofrompath=<repository>,<url>

Replace <repository> with the name of the repository you want to list packages from and <url> with the URL of the repository.

By using either Yum or RPM, you can easily list all installed packages on your CentOS system. This is a great way to keep track of what packages are installed and ensure that your system is up to date.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?