How To List Installed Packages From A Certain Repository In Linux

List Installed Packages From A Certain Repository

We already know how to list the installed repositories in Unix-like operating systems. Today, let me show you how to list installed packages from a certain repository in Linux from command line. This can be useful when you wanted to know which packages are from which repositories.

List Installed Packages From A Certain Repository In Linux

Arch Linux

In Arch Linux and its derivatives such as Antergos, Manjaro Linux, run the following command to know the list of installed packages from a certain repository.

paclist community

The above command  will list the installed packages from the community repository in Arch Linux.

Sample output:

acpi 1.7-1
acpid 2.0.28-1
arj 3.10.22-11
at 3.1.20-3
atril 1.18.0-1
bamf 0.5.3-1
blueman 2.0.4-3
blur-effect 1.1.2-1
.
.
.
wpscan 1:2.9.2-3
xcur2png 0.7.1-4
yaml-cpp 0.5.3-3
youtube-dl 2017.06.05-1
zathura 0.3.7-1
zathura-pdf-poppler 0.2.7-1
zeromq 4.2.1-1
zim 0.66-1

Or, you can use the following command if you want to display only the name of installed packages without version number.

awk '{print $1}' <(paclist community)

RHEL / CentOS:

In RHEL, and its clones like CentOS, Scientific Linux, view the installed packages using command:

yum list installed | grep @epel

This command will list the installed packages from EPEL repository.

dnf.noarch 0.6.4-2.el7 @epel 
dnf-conf.noarch 0.6.4-2.el7 @epel 
dnf-plugins-core.noarch 0.1.5-3.el7 @epel 
epel-release.noarch 7-9 @epel 
libcomps.x86_64 0.1.6-13.el7 @epel 
python-dnf.noarch 0.6.4-2.el7 @epel 
python-libcomps.x86_64 0.1.6-13.el7 @epel

You can also get the list of installed packages from a certain repository using yumdb command. Yumdb is not installed by default. You need to install yum-utils package to use yumdb command.

sudo yum install yum-utils

Now, use yumdb command to list the installed packages from a particular repository.

yumdb search from_repo epel

The above command will display the installed packages from EPEL repository.

dnf-0.6.4-2.el7.noarch
 from_repo = epel

dnf-conf-0.6.4-2.el7.noarch
 from_repo = epel

dnf-plugins-core-0.1.5-3.el7.noarch
 from_repo = epel

epel-release-7-9.noarch
 from_repo = epel

libcomps-0.1.6-13.el7.x86_64
 from_repo = epel

python-dnf-0.6.4-2.el7.noarch
 from_repo = epel

python-libcomps-0.1.6-13.el7.x86_64
 from_repo = epel

Also, you can print the output in print-friendly format with awk command as shown below.

yumdb search from_repo epel* |awk -F"\n" '{ RS=""; print $1 }'

Here, epel is the REPOID. You can get the repoid by running the following command:

yum repolist

Reposquery is yet another command to list the installed packages from a certain repository in YUM based systems. Please note that you need to install yum-utils package in-order to use repoquery command.

To list the installed packages from EPEL repository using reposquery, just run:

repoquery -a --installed --qf "%{ui_from_repo} %{name}" | grep '^@epel'

Sample output from my CentOS 7 server system.

@epel dnf
@epel dnf-conf
@epel dnf-plugins-core
@epel epel-release
@epel libcomps
@epel python-dnf
@epel python-libcomps

Debian / Ubuntu / Linux Mint

In APT-based systems, you can find the list of installed packages from a particular repository using command:

grep ^Package: /var/lib/apt/lists/ppa.launchpad.net_*_Packages

Sample output:

/var/lib/apt/lists/ppa.launchpad.net_linrunner_tlp_ubuntu_dists_xenial_main_binary-amd64_Packages:Package: tp-smapi-dkms
/var/lib/apt/lists/ppa.launchpad.net_linrunner_tlp_ubuntu_dists_xenial_main_binary-amd64_Packages:Package: tlp
/var/lib/apt/lists/ppa.launchpad.net_linrunner_tlp_ubuntu_dists_xenial_main_binary-amd64_Packages:Package: tlp-rdw
/var/lib/apt/lists/ppa.launchpad.net_linrunner_tlp_ubuntu_dists_xenial_main_binary-i386_Packages:Package: tp-smapi-dkms
/var/lib/apt/lists/ppa.launchpad.net_linrunner_tlp_ubuntu_dists_xenial_main_binary-i386_Packages:Package: tlp
/var/lib/apt/lists/ppa.launchpad.net_linrunner_tlp_ubuntu_dists_xenial_main_binary-i386_Packages:Package: tlp-rdw

The above command will list the packages from all PPAs on your Ubuntu system.

Also, you can list the installed packages from a repository with command:

grep Package /var/lib/apt/lists/in.archive.ubuntu.com_ubuntu_dists_xenial_multiverse_*_Packages

This command will list the packages from multiverse repository.


Recommended Read: 


SUSE / openSUSE

Zypper makes it much easier to list the installed packages from a certain repository In SUSE, openSUSE systems.

All you need to do is open Terminal and run the following command.

zypper pa -ir <repo-name_or_number>

You can find the repository name or its number using the following command:

zypper lr

Sample output:

# | Alias | Name | Enabled | GPG Check | Refresh
--+---------------------+------------------------------+---------+-----------+--------
1 | repo-non-oss | openSUSE-leap/42.1-Non-Oss | Yes | (r ) Yes | Yes 
2 | repo-oss | openSUSE-leap/42.1-Oss | Yes | (r ) Yes | Yes 
3 | repo-update | openSUSE-42.1-Update | Yes | (r ) Yes | Yes 
4 | repo-update-non-oss | openSUSE-42.1-Update-Non-Oss | Yes | (r ) Yes | Yes

Say for example, the following command will list the packages from “repo-oss” repository:

zypper search -ir repo-oss

Or, simply use the repository number as shown below.

zypper search -ir 2

Sample output:

Loading repository data...
Reading installed packages...

S | Name | Summary | Type 
--+--------------------------------------------+-------------------------------------------------------------------------+------------
i | Apper | KDE application and package management tool | application
i | Firefox | Web Browser | application
i | GParted | Create, reorganize, and delete partitions | application
i | Hugin batch processor | A GUI queue manager for stitching multiple hugin projects | application
.
.
.
i | zisofs-tools | User tools for zisofs | package 
i | zypp-plugin-python | Helper that makes writing ZYpp plugins in python easier | package 
i | zypper-aptitude | aptitude compatibility with zypper | package 
i | zypper-log | CLI for accessing the zypper logfile | package

And, that’s all for now. Hope you find this useful. I will be soon here with another interesting articles. Until then, stay tuned with OSTechNix. If you like our articles, please share them on your social, professional networks, so other users can also benefit from them.

Cheers!

Resources:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You may also like...