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
Fedora 41 (
dnf5)repo=X dnf list --installed | grep "${repo}$"notes:
- replace
--installedwith--availableto list all available packages from the repo. - the trailing
$symbol above is regular expression syntax for end of line. we're filtering the output ofdnf listfor lines ending in the repository name. - there is an open issue to add support for dnf5 repository filtering.
- replace
Fedora 36 to 40 (inclusive)
repo=X dnf repository-packages "${repo}" list --installedCentOS / RHEL / Fedora 22 or earlier
repo=X yum list installed | grep "${repo}"Fedora 23
repo=X dnf list installed | grep "${repo}"RHEL8
repo=X dnf repo-pkgs "${repo}" list installed
- 14This 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.Todd Walton– Todd Walton2017-03-07 16:09:25 +00:00Commented Mar 7, 2017 at 16:09
- You may need to run those commands as root until bugzilla.redhat.com/show_bug.cgi?id=1525645 is fixed.proski– proski2017-12-13 19:27:05 +00:00Commented Dec 13, 2017 at 19:27
- 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.Jayen– Jayen2018-06-11 02:22:22 +00:00Commented Jun 11, 2018 at 2:22
- @Todd Watson I know, it is a hack, but what about "export COLUMNS=999 yum..."Massimo– Massimo2018-08-20 20:01:55 +00:00Commented Aug 20, 2018 at 20:01
- 1On my Fedora41, I can use
dnf repoquery --disablerepo=* --enablerepo=fedora-cisco-openh264to show all packages from that repo.kyrre– kyrre2024-11-02 20:16:24 +00:00Commented Nov 2, 2024 at 20:16
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 }' Using egrep or grep -e
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 - Just a side-note: To list all packages from a specified repo, do
repoquery -qa --repoid=REPONAMEILMostro_7– ILMostro_72014-12-15 01:44:32 +00:00Commented Dec 15, 2014 at 1:44 - 2This is also a great answer. The output is longer than the accepted answer, but it's formatted in a nicer way.Routhinator– Routhinator2015-06-15 10:31:41 +00:00Commented Jun 15, 2015 at 10:31
- Can be simplified to
repoquery -a --repoid=REPONAMEbecause according to man page-qoption is for rpmquery compatibility, doesn't do anything.Rockallite– Rockallite2017-02-16 02:10:43 +00:00Commented Feb 16, 2017 at 2:10 - @Rockallite is right; for dnf, the
-qaactually fails. I can't upvote the comment due to previously removing the upvote :( I'm updating the answer to reflect that.ILMostro_7– ILMostro_72018-08-21 01:47:33 +00:00Commented Aug 21, 2018 at 1:47 - 1Unfortunately 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 properlymaloo– maloo2020-05-13 17:12:25 +00:00Commented May 13, 2020 at 17:12
dnf repo-pkgs <repoid> list installed Notes
The command above uses DNF to list the packages installed from the <repoid>. Note repo-pkgs is just an alias of repository-packages.
From the man pages:
man dnf | grep "repository-packages.*list.*installed" -A 1 Further reading:
man dnf - 1Best 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.akostadinov– akostadinov2020-04-07 12:24:40 +00:00Commented Apr 7, 2020 at 12:24
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 "%{ui_from_repo} %{name}" | grep '^@epel' and a more complex example:
repoquery -a --installed --qf "%-20{ui_from_repo} %-30{name} %-7{arch} %{epoch}:%-12{version} %-4{release}" | grep '^@epel' RHEL Server 7.5 (Maipo)
yum repo-pkgs <repoid> list installed can be used to retrieve the same info as yumdb search from_repo <repoid>, but in a different format.
# yum help repo-pkgs repo-pkgs <repoid> <list|info|install|remove|upgrade|reinstall*|remove-or-*> [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 Sample epel outputs:
# 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 You could check the Vendor header of installed rpms.
This example lists all package from VideoLAN repository:
rpm -q -a --qf "%{Name}:%{Vendor}\n" \ | grep -F ":VideoLAN Project (http://www.videolan.org)" Obviously, you need to determine if the Vendor header of your repository is unique among different repositories.
- 3There isn't a one-to-one mapping between Vendor and repos, and in some cases, the Vendor string is blank.Lorin Hochstein– Lorin Hochstein2011-10-13 16:36:52 +00:00Commented Oct 13, 2011 at 16:36
For people who just want to find missing repositories:
yum list installed | awk '{print $3}' | sort | uniq This should return all repositories where you have packages installed from.
Adding a "-q" flag to yum command will also filter the unnecessary output lines, e.g. loaded plugins, etc.
yum -q list installed | awk '{print $3}' | sort | uniq For RHEL 8:
dnf repository-packages epel list - 1Could you say something about what this does that none of the other answers already accomplishes?2021-06-02 07:47:04 +00:00Commented Jun 2, 2021 at 7:47