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).
- 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
sudo yum list installed | grep xorg
To display the details on a particular package with YUM:
yum info httpd
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)
–yoption answers yes to all installation prompts
catcommand concatenates the contents of the file into the yum install command
For more information on the yum command, use
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
–qoption means query
–aoption 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
–qoption stands for query
–ioption stands for info
Count the total number of packages installed:
sudo rpm –qa | wc –l
- The wc command creates a word count
–loption counts the number of lines
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
sudo repoquery –a ––installed
The yum-utils package uses yum repositories to pull information.
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.