How to List Installed Packages on CentOS ?

Source: Internet
Author: User
Keywords centos package list centos list installed packages centos list installed packages yum
In this tutorial, we will show you how to list and filter the installed packages on CentOS. In situations where the same software package needs to be installed on another machine or the system needs to be reinstalled, it may be helpful to know how to list the installed packages on the CentOS system.

We will also show you how to check if a specific package is installed, count the installed packages and find the version of the installed package.

Alibaba Cloud Simple Application Server:  Anti COVID-19 SME Enablement Program
$300 coupon package for all new SMEs and a $500 coupon for paying customers.

List the packages installed with Yum
YUM (Yellow Dog Update Program) is the default CentOS package manager. It can be used to download, install, delete, query and manage CentOS RPM packages from official and third-party CentOS repositories.

To use yum to list the installed packages on the CentOS system, use the following command:
sudo yum list installed
It will print a list of all installed packages, including information about the version and repository of the RPM package.

Usually, the list of packages is very long. To improve readability, it is best to pipe the output to less:
sudo yum list installed | less
To determine whether a particular package is installed, use the grep command to filter the output.

For example, to determine whether the unzip package is installed on the system, you can run:
sudo yum list installed | grep unzip
unzip.x86_64 6.0-19.el7 @anaconda
The above output shows that the 6.0-19 decompressed version is installed on the computer.

List installed packages with Rpm
The rpm command with the -q option allows you to query packages.

The following command will list all installed packages:
sudo rpm -qa
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 your system:
sudo rpm -q tmux
If the package is installed, you will see something similar to the following:
tmux-1.8-4.el7.x86_64
Otherwise, the command will print:
package tmux2is not installed
To get more information about the parcel pass in question, -i:
sudo rpm -qi tmux
Create a list of all installed packages
To create a list of names of all installed packages on the CentOS system and save it in a file named packages_list.txt, redirect the command output to a file:
sudo rpm -qa> packages_list.txt
To install the same packages on other servers, you can use the cat command to pass all packages to yum:
sudo yum -y install $(cat packages_list.txt)

Count the number of installed packages
To find out how many packages are installed on the 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:

sudo rpm -qa | wc -l

603

The above output shows that 603 packages have been installed.

in conclusion
In the CentOS system, you can use the yum list installed and rpm -qa commands to list the installed packages.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.