How to List Installed Packages on CentOS 7

29/12/2020
Linux based operating systems such as CentOS have a modular packaging system. It helps reduce system file size and also makes package installation faster. CentOS is an RPM based distribution. The package files are distributed as an RPM archive. The RPM archives has the file extension .rpm. CentOS uses the YUM, an RPM package manager to install, remove and update packages. Recently newer version of Fedora started to use DNF package manager which one day may replace YUM.

As a Linux system administrator, it is a very common task to list all the installed packages of CentOS and other Linux based distributions. So in this article, I will show you how to list all the installed packages of CentOS 7. Let’s get started.

Listing Installed Packages on CentOS 7 with rpm Command:

You can use the rpm command to list all the installed packages on your CentOS 7 machine.

Run the following command to list all the installed packages on CentOS 7:

$ sudo rpm -qa

A long list of package that are installed on your CentOS 7 machine should be displayed.

Since the list is very long, you can pipe the output of the rpm command to less pager as follows:

$ sudo rpm -qa | less

Now you can press <Enter> to move forward one line at a time, or press <Space> to move forward several lines at a time. You can also press the <Up> and <Down> arrow keys to navigate through the list.

You can also search for packages here as well. Just press / and type in the search term (without space) you’re looking for. Once you’re done, press <Enter>. The lines containing the search term should be highlighted as you can see in the screenshot below. You can also press n and p to go to the next match and previous match respectively. Once you’re done, you can press q to exit out of the less pager.

Listing Installed Packages on CentOS 7 with YUM:

You can also list all the installed packages of your CentOS 7 machine with YUM package manager.

Run the following command to list all the installed packages of your CentOS 7 machine with yum:

$ sudo yum list installed

As you can see, the list of all the installed packages is displayed. It is a very long list.

Since the list is very long, you can also pipe the output of the yum command to the less pager as follows:

$ sudo yum list installed | less

As you can see, the output is opened with less pager. Now you can navigate the list using the <Up> and <Down> arrow keys or <Space> and <Enter> keys just like before. You can also search the list for certain term. I will show you a better way to search for installed packages with certain keyword later in this article.

Listing Installed Packages with repoquery:

repoquery is an interesting command. With repoquery you can do many things like search for a package that contains a certain file, see information about certain package, and of course list all the installed packages on CentOS 7.

repoquery is part of the yum-utils package which is not installed by default. You can install it with the following command:

$ sudo yum install yum-utils -y

You can list all the installed packages of your CentOS 7 machine with repoquery with the following command:

$ repoquery -a –installed

As you can see, all the installed packages are listed.

Checking for Specific Installed Packages on CentOS 7:

Now that you know how to list all the packages that are installed on your CentOS 7 machine, you can easily check whether a certain package is installed on your CentOS 7 machine.

One way is to search for the package with the less pager as shown earlier. The other way is to use grep or egrep, which is what I am going to show you in this section of the article.

For example, you can search for all the package name that has the keyword gnome in it with the following command:

$ sudo yum list installed | egrep -i gnome

NOTE: Here, the option -i is used for case insensitive search. By default, case sensitive search is performed. If you wish to perform case sensitive search, just remove the -i option.

As you can see, all the packages that has the keyword gnome is listed.

If you want to list all the package that starts with the keyword gnome, then run the following command:

$ sudo yum list installed | egrep -i ‘^gnome’

As you can see, all the package that starts with the keyword gnome is listed.

You can also list the packages that are not system dependent (noarch packages) with the following command:

$ sudo rpm -qa | egrep -i ‘noarch$’

As you can see, all the packages that do not depend on the system architecture is listed.

So that’s how you list all the installed packages on CentOS 7. Thanks for reading this article.

ONET IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, ONET IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

[Snort] Hướng dẫn đẩy log snort lên graylog

Ở bài trước thì các bạn đã biết được cách làm sao để cài đặt được snort lên trên máy centos...
30/12/2020

Nextcloud [Part 1] – Cài đặt Nextcloud trên CentOS 7

Mục lục Chuẩn bị môi trường Cài đặt dịch vụ Web Cài đặt MariaDB Cài đặt PHP 7.2 Cài...
30/12/2020

Cách sử dụng Fail2ban để bảo mật máy chủ CentOS

Mục lục Giới thiệu Cài đặt và cấu hình Giám sát cấu hình firewall và nhật ký Fail2ban Giám...
30/12/2020
Bài Viết

Bài Viết Mới Cập Nhật

SỰ KHÁC BIỆT GIỮA RESIDENTIAL PROXY VÀ PROXY DATACENTER
17/02/2024

Mua Proxy v6 US Private chạy PRE, Face, Insta, Gmail
07/01/2024

Mua shadowsocks và hướng dẫn sữ dụng trên window
05/01/2024

Tại sao Proxy Socks lại được ưa chuộng hơn Proxy HTTP?
04/01/2024

Mua thuê proxy v4 nuôi zalo chất lượng cao, kinh nghiệm tránh quét tài khoản zalo
02/01/2024