List all RPM packages installed from repo "X"
CentOS / RHEL / Fedora 22 or earlier
yum list installed | grep @epel
Fedora 23 or later
dnf list installed | grep @epel
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
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