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

[CI/CD] Phần 2: Hướng dẫn cài đặt Jenkins trên CentOS 7

Jenkins là phần mềm tự động hóa, mã nguồn mở và viết bằng Java. Với Jenkins, các nhà phát triển...
30/12/2020

Nextcloud [Part 3] – Quản lý User trên NextCloud

Mục lục Login vào NextCloud Tạo mới User Tạo mới Group Thêm User vào Group 1. Login vào NextCloud Thực...
30/12/2020

Script #1 : File Integrity Monitor (FIM) – Giám sát sự thay đổi của file trên Linux

Khi sử dụng một máy chủ, ta cần theo dõi tính toàn vẹn của file. Khi file bị thay đổi ta cần...
30/12/2020
Bài Viết

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

Mua proxy v4 chạy socks5 để chơi game an toàn, tốc độ cao
18/05/2024

Thuê mua proxy Telegram trọn gói, tốc độ cao, giá siêu hời
18/05/2024

Thuê mua proxy Viettel ở đâu uy tín, chất lượng và giá tốt? 
14/05/2024

Dịch vụ thuê mua proxy US UK uy tín, chất lượng số #1
13/05/2024

Thuê mua proxy Việt Nam: Báo giá & các thông tin MỚI NHẤT
13/05/2024