In this tutorial, we described how to list and filter installed packages on CentOS system. It is always useful to you if you know which packages are installed on your system. You can install same packages on another system if you know how to check installed package on your current CentOS system or you can re-install. This guide will help to check whether a specific package is installed, count of installed packages and check version of installed packages.
List Installed Packages
YUM is a package manager which have command-line interface to manage packages in CentOS system. You can list installed packages using
yum command. For get list of installed packages on CentOS, execute the following command in terminal:
sudo yum list installed
In output, it will show a list of installed packages along with the version and repository as given below:
The packages list will be long so it would better to see list using pipe and make output
less and easier to read:
sudo yum list installed | less
If you want to find any specific package is installed or not, you can filter combine grep command along with the apt command. For example, if you want check Unzip is installed on your CentOS system or not, then run below command:
sudo yum list installed | grep unzip
It will show output as below:
unzip.x86_64 6.0-16.el7 installed
List Installed Packages with Rpm
You can easily check the installed package on CentOS system using
rpm command. Run the below command to list all the installed packages:
sudo rpm -qa
In CentOS, rpm only print the package names.
If you would like to list or filter any specific package then, you can use
-q command. The below command will show you whether the Unzip is installed on the system or not:
sudo rpm -q unzip
If the packages is installed then, output should show as below:
Otherwise, the command will print:
Output package skype is not installed
Export List of Installed Packages
You can list the installed package on your CentOS system and export as a file using rpm command. Execute the following command to export list of all installed packages on your CentOS system:
sudo rpm qa --installed > installed_packages.txt
Now, you can use cat command to pass all packages to yum for install to your another system. Run the below command to install those packages:
sudo yum -y install $(cat installed_packages.txt)
Count number of packages installed
You can get count number of installed packages using the below command:
sudo rpm -qa | wc -l
It should show output as below:
In above output you can see 394 packages installed on my CentOS system.
You successfully learned how to list installed package and find specific installed package on your CentOS machine.
If you have any questions or suggestion, please leave a comment below.
Leave a Reply