How To List Installed Packages 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.
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:
It will print a list of all installed packages, including information about the versions and repository of the RPM packages.
Usually, the packages list is long, for better readability it is a good idea to pipe the output to 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:
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:
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:
If the package is installed, you will see something like this:
Otherwise, the command will print:
To get more information about the queried package pass -i:
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:
To install the same packages on another server you can use the cat command to pass all packages to yum:
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:
The output above shows that there are 639 packages installed.
In CentOS systems you can list installed packages using the yum list installed and rpm -qa commands.