- List all RPM packages installed from repo «X»
- 8 Answers 8
- Fedora 36 or later
- CentOS / RHEL / Fedora 22 or earlier
- Fedora 23
- RHEL8
- Pretty-print
- list_ALL_AVAILABLE_from_repo
- Notes
- RHEL Server 7.5 (Maipo)
- 3 Ways to List All Installed Packages in RHEL, CentOS and Fedora
- 1. Using RPM Package Manager
- 2. Using YUM Package Manager
- 3. Using YUM-Utils
- Related Posts
- 3 thoughts on “3 Ways to List All Installed Packages in RHEL, CentOS and Fedora”
- How to List Installed Packages on CentOS with Yum or RPM
- How to List Installed Packages with YUM
- List Installed Packages with RPM
- List Installed Packages with yum-utils
List all RPM packages installed from repo «X»
How can I get a list of all of the RPM packages that have been installed on my system from a particular repo (e.g., «epel»)?
8 Answers 8
Fedora 36 or later
dnf repository-packages epel list
CentOS / RHEL / Fedora 22 or earlier
yum list installed | grep @epel
Fedora 23
dnf list installed | grep @epel
RHEL8
dnf repo-pkgs epel list installed
This will not work. Yum will output lines to the pipe that will be broken if they get too long. So grep’s input is mostly one line per package, but it could be two lines. Yum could pass «whizbanger.x86_64 ___ 3.8.4-2.el6 _______________ @epel». (Imagine the underscores as spaces.) The «@epel» is on the next line of the input grep sees. So grep is going to output that line with nothing but «@epel» but not the preceding line with the package name.
You may need to run those commands as root until bugzilla.redhat.com/show_bug.cgi?id=1525645 is fixed.
the yum command doesn’t seem to work if one the repos is having issues. i needed this list to see if i wanted to disable the repo with issues.
Does that work, @Massimo? That would be a nice workaround. I found also this Unix StackExchange question: unix.stackexchange.com/questions/308731/…
As of RHEL6, as suggested in this stackoverflow answer, there’s a more thorough method of doing this with yumdb :
yumdb search from_repo REPOID*
The repoid takes wild cards.
Pretty-print
If we’re going to cheat and pipe the output, then we can achieve pretty-print effect as well. Here’s one using awk
yumdb search from_repo REPOID* |awk -F"\n" '< RS=""; print $1 >'
yumdb search from_repo REPOID* |egrep -v '(from_repo|^$)'
list_ALL_AVAILABLE_from_repo
To list all available packages in a specified repository, do:
repoquery -a --repoid=REPONAME
This is also a great answer. The output is longer than the accepted answer, but it’s formatted in a nicer way.
Can be simplified to repoquery -a —repoid=REPONAME because according to man page -q option is for rpmquery compatibility, doesn’t do anything.
@Rockallite is right; for dnf, the -qa actually fails. I can’t upvote the comment due to previously removing the upvote 🙁 I’m updating the answer to reflect that.
Unfortunately this doesn’t work well if packages have been installed using dnf as yum just lists those as ‘installed’ and doesn’t specify the repo they came from. If you have installed packages via dnf the answer from @Peque will work properly
dnf repo-pkgs list installed
Notes
The command above uses DNF to list the packages installed from the . Note repo-pkgs is just an alias of repository-packages .
man dnf | grep "repository-packages.*list.*installed" -A 1
Best answer, works also with RHEL 7.7 yum . answers grepping for repo ID fails because sometimes tabulation causes packages and repos to go on different lines. This one is solid though.
Grepping yum’s output is the most obvious way:
yum list installed | grep @epel
However, you can’t display extra packages properties and it’s difficult to parse with a script. The tool repoquery from the package yum-utils is the tool, but it isn’t installed by default.
repoquery -a --installed --qf "% %" | grep '^@epel'
and a more complex example:
repoquery -a --installed --qf "%-20 %-30 %-7 %:%-12 %-4" | grep '^@epel'
RHEL Server 7.5 (Maipo)
yum repo-pkgs list installed can be used to retrieve the same info as yumdb search from_repo , but in a different format.
# yum help repo-pkgs repo-pkgs [pkg(s)] Treat a repo. as a group of packages, so we can install/remove all of them aliases: repo-packages, repository-pkgs, repository-packages
# yumdb search from_repo epel htop-2.2.0-1.el7.x86_64 from_repo = epel supervisor-3.1.4-1.el7.noarch from_repo = epel # yum repo-pkgs epel list installed Installed Packages htop.x86_64 2.2.0-1.el7 @epel supervisor.noarch 3.1.4-1.el7 @epel
3 Ways to List All Installed Packages in RHEL, CentOS and Fedora
One of the several duties of a system administrator is to install and manage software on a computer system-Linux in this case and in order keep track of installed/available software packages on your system, you can learn, and/or keep in mind a few quick commands.
In this article, we will explain how to list all installed rpm packages on CentOS, RHEL and Fedora distributions using four different ways.
1. Using RPM Package Manager
RPM (RPM Package Manager) formerly known as Red-Hat Package Manager is an open source, low-level package manager, which runs on Red Hat Enterprise Linux (RHEL) as well as other Linux such as CentOS, Fedora and UNIX systems.
You can compare it to DPKG Package Manager, the default packaging system for Debian and it’s derivatives such as Ubuntu, Kali Linux etc.
The following command will print a list of all installed packages on your Linux system, the flag -q meaning query and -a enables listing of all installed packages:
2. Using YUM Package Manager
YUM (Yellowdog Updater, Modified) is an interactive, front-end rpm based, package manager.
You can use the yum command below to list all installed packages on your system, one advantage with this method is, it includes the repository from which a package was installed:
3. Using YUM-Utils
Yum-utils is an assortment of tools and programs for managing yum repositories, installing debug packages, source packages, extended information from repositories and administration.
To install it, run the command below as root, otherwise, use sudo command:
# yum update && yum install yum-utils
Once you have it installed, type the repoquery command below to list all installed packages on your system:
To list installed packages from a particular repository, use the yumdb program in the form below:
# yumdb search from_repo base
Read more about package management in Linux:
In this article, we showed you how to list all installed packages on CentOS or RHEL four different ways. Share your thoughts concerning this article via the feedback section below.
Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge.
Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.
Related Posts
3 thoughts on “3 Ways to List All Installed Packages in RHEL, CentOS and Fedora”
Hi. Since the release of Fedora 22, in which DNF became the new default packaging tool and therefore obsoleted yum command on subsequent Fedora OSs, YUM was kept on those Fedora OSs for compatibility reason regarding Linux distributions forked from the Fedora project (Red Hat, Centos) that kept on using YUM, and will be kept for that very reason until they adopt it definitively. I had little time before your previous post as reply, to test a command of my investigation that also relies as well on expression ‘wc -l‘ . Such command is likely to cover all current active repositories on a system which is indeed exactly what I was aiming to. Here are for comparative purpose the following commands (by the way, there is no need to be executed as user root): ‘dnf list installed|wc -l‘, ‘rpm -qa|wc -l‘ respective outputs: 1619, 1590. As noticeable those outputs are incorrect which is no surprise after investigation. Their subsequent commands are inappropriate; they do not reflect exclusively the current active repositories on my system, which in that case are fedora, updates which respectively contain 54 801, 13 085 packages (subsequent results are available from another command too). Good luck though in your hobby. Reply
Hi. For Fedora, as output, the number (not the list) of all packages (available and installed) regarding a specific added repository . Regards. Reply
@Ricky You can pipe the output of the above commands to wc utility with the -l switch, to get the number instead of a list of installed packages, like this:
# yum list installed | wc -l OR # rpm -qa | wc -l
How to List Installed Packages on CentOS with Yum or RPM
Managing a CentOS operating system often means knowing the software packages that are installed. This list can be used for rolling out software updates, rebuilding an operating system, or even duplicating a work environment on another machine.
This guide provides three simple methods to list installed software packages on CentOS (and other RedHat-based Linux systems).
- Access to a user account with sudo or root privileges
- A terminal window or command line
- The YUM and RPM package managers, included by default
How to List Installed Packages with YUM
YUM stands for Yellowdog Updater, Modified. It is an updated package manager that allows you to install, remove, update, view, or search software packages.
Use the following yum command to display all installed packages:
To check if a specific package is installed with YUM, filter the output with the grep command:
sudo yum list installed | grep xorg
To display the details on a particular package with YUM:
YUM can also output the full package list to a file:
sudo yum list installed > listed_packages.txt
This file can be copied to another system to duplicate the installed packages:
sudo yum –y install $(cat listed_packages.txt)
- The –y option answers yes to all installation prompts
- The cat command concatenates the contents of the file into the yum install command
For more information on the yum command, use yum ––help .
List Installed Packages with RPM
RPM stands for RedHat Package Manager. It comes as standard with most Red-Hat-based Linux operating systems, such as CentOS and Fedora.
To display a list of installed packages, enter the following in a terminal window:
To list packages by installation date, enter:
Search for a package by name using:
sudo rpm –qa | grep –i httpd
This command returns results for the Apache software.
Output the list of packages to a file by entering the following:
sudo rpm –qa > listed_packages.txt
This command saves a copy of the list in a text file called listed_packages.txt in the current working directory.
Display information about a particular package:
- The –q option stands for query
- The –i option stands for info
Count the total number of packages installed:
RPM lists packages by their package name and revision number. Text-wrapping can make this tool harder to read. Use the rpm ––help command for more options, or refer to the documentation.
List Installed Packages with yum-utils
Yum-utils is a software package that adds functionality to the standard YUM package manager.
To install the yum-utils software package enter:
sudo yum –y install yum-utils
List all installed packages with the repoquery command:
sudo repoquery –a ––installed
The yum-utils package uses yum repositories to pull information.
Now you understand how to list and filter installed packages on CentOS. This guide provided three methods (YUM, RPM, or yum-utils) for listing packages on YUM based Linux distributions.
If you want to find out more on RPM and YUM, read our article and find out how RPM and YUM differ.