How To Find The List Of Installed Repositories From Commandline In Linux

How To Find The List Of Installed Repositories From Commandline In Linux

This brief tutorial explains how to find the list of installed repositories from command line in different Linux platforms. Finding installed repositories from command line mode is not only easier, but also faster method than GUI mode. There could be many ways to do it, however these are just enough to get the job done.

Find The List Of Installed Repositories In Linux

List installed packages in RPM based systems

In CentOS, RHEL, Scientific Linux:

To view the list of installed repositories in RPM based systems such as CentOS, RHEL, and Scientific Linux, run the following command:

sudo yum repolist

Sample output:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.fibergrid.in
 * epel: ftp.cuhk.edu.hk
 * extras: mirror.fibergrid.in
 * updates: mirror.fibergrid.in
repo id repo name status
!base/7/x86_64 CentOS-7 - Base 9,363
!docker-main-repo Docker main Repository 110
!epel/x86_64 Extra Packages for Enterprise Linux 7 - x86_64 11,722
!extras/7/x86_64 CentOS-7 - Extras 380
!updates/7/x86_64 CentOS-7 - Updates 1,838
repolist: 23,413

Or, use the following command:

sudo yum repolist all

Output from CentOS 7 server edition:

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.fibergrid.in
 * epel: ftp.cuhk.edu.hk
 * extras: mirror.fibergrid.in
 * updates: mirror.fibergrid.in
repo id repo name status
C7.0.1406-base/x86_64 CentOS-7.0.1406 - Base disabled
C7.0.1406-centosplus/x86_64 CentOS-7.0.1406 - CentOSPlus disabled
C7.0.1406-extras/x86_64 CentOS-7.0.1406 - Extras disabled
C7.0.1406-fasttrack/x86_64 CentOS-7.0.1406 - CentOSPlus disabled
C7.0.1406-updates/x86_64 CentOS-7.0.1406 - Updates disabled
C7.1.1503-base/x86_64 CentOS-7.1.1503 - Base disabled
C7.1.1503-centosplus/x86_64 CentOS-7.1.1503 - CentOSPlus disabled
C7.1.1503-extras/x86_64 CentOS-7.1.1503 - Extras disabled
C7.1.1503-fasttrack/x86_64 CentOS-7.1.1503 - CentOSPlus disabled
C7.1.1503-updates/x86_64 CentOS-7.1.1503 - Updates disabled
C7.2.1511-base/x86_64 CentOS-7.2.1511 - Base disabled
C7.2.1511-centosplus/x86_64 CentOS-7.2.1511 - CentOSPlus disabled
C7.2.1511-extras/x86_64 CentOS-7.2.1511 - Extras disabled
C7.2.1511-fasttrack/x86_64 CentOS-7.2.1511 - CentOSPlus disabled
C7.2.1511-updates/x86_64 CentOS-7.2.1511 - Updates disabled
!base/7/x86_64 CentOS-7 - Base enabled: 9,363
base-debuginfo/x86_64 CentOS-7 - Debuginfo disabled
base-source/7 CentOS-7 - Base Sources disabled
c7-media CentOS-7 - Media disabled
centosplus/7/x86_64 CentOS-7 - Plus disabled
centosplus-source/7 CentOS-7 - Plus Sources disabled
cr/7/x86_64 CentOS-7 - cr disabled
!docker-main-repo Docker main Repository enabled: 110
!epel/x86_64 Extra Packages for Enterprise Linu enabled: 11,722
epel-debuginfo/x86_64 Extra Packages for Enterprise Linu disabled
epel-source/x86_64 Extra Packages for Enterprise Linu disabled
epel-testing/x86_64 Extra Packages for Enterprise Linu disabled
epel-testing-debuginfo/x86_64 Extra Packages for Enterprise Linu disabled
epel-testing-source/x86_64 Extra Packages for Enterprise Linu disabled
!extras/7/x86_64 CentOS-7 - Extras enabled: 380
extras-source/7 CentOS-7 - Extras Sources disabled
fasttrack/7/x86_64 CentOS-7 - fasttrack disabled
!updates/7/x86_64 CentOS-7 - Updates enabled: 1,838
updates-source/7 CentOS-7 - Updates Sources disabled
repolist: 23,413

The above command will list all repositories i.e both enabled and disabled repositories.

To list only enabled repos, run the following command:

yum repolist enabled

To list only disabled repos, enter:

yum repolist disabled

In Fedora:

sudo dnf repolist

List installed packages in DEB based systems

Run the following command to view the list of installed packages in DEB based systems like Debian, Ubuntu, Linux Mint etc.

sudo apt-cache policy

Sample output would be:

Package files:
 100 /var/lib/dpkg/status
 release a=now
 500 http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2/multiverse amd64 Packages
 release o=mongodb,a=trusty,n=trusty/mongodb-org,l=mongodb,c=multiverse,b=amd64
 origin repo.mongodb.org
 500 http://ppa.launchpad.net/linrunner/tlp/ubuntu xenial/main i386 Packages
 release v=16.04,o=LP-PPA-linrunner-tlp,a=xenial,n=xenial,l=TLP,c=main,b=i386
 origin ppa.launchpad.net
 500 http://ppa.launchpad.net/linrunner/tlp/ubuntu xenial/main amd64 Packages
 release v=16.04,o=LP-PPA-linrunner-tlp,a=xenial,n=xenial,l=TLP,c=main,b=amd64
 origin ppa.launchpad.net
 .
 .
 .
 .
 500 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 Packages
 release v=16.04,o=Ubuntu,a=xenial,n=xenial,l=Ubuntu,c=universe,b=amd64
 origin in.archive.ubuntu.com
 500 http://in.archive.ubuntu.com/ubuntu xenial/restricted i386 Packages
 release v=16.04,o=Ubuntu,a=xenial,n=xenial,l=Ubuntu,c=restricted,b=i386
 origin in.archive.ubuntu.com
 500 http://in.archive.ubuntu.com/ubuntu xenial/restricted amd64 Packages
 release v=16.04,o=Ubuntu,a=xenial,n=xenial,l=Ubuntu,c=restricted,b=amd64
 origin in.archive.ubuntu.com
 500 http://in.archive.ubuntu.com/ubuntu xenial/main i386 Packages
 release v=16.04,o=Ubuntu,a=xenial,n=xenial,l=Ubuntu,c=main,b=i386
 origin in.archive.ubuntu.com
 500 http://in.archive.ubuntu.com/ubuntu xenial/main amd64 Packages
 release v=16.04,o=Ubuntu,a=xenial,n=xenial,l=Ubuntu,c=main,b=amd64
 origin in.archive.ubuntu.com
Pinned packages:

Or, use this command to find the installed repositories in your DEB based system.

sudo grep -Erh ^deb /etc/apt/sources.list*

Here is the output from my Ubuntu 16.04 LTS server.

deb http://in.archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://in.archive.ubuntu.com/ubuntu/ xenial universe
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://in.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://in.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
deb http://archive.ubuntu.com/ubuntu xenial universe
deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse
deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse
deb http://ppa.launchpad.net/linrunner/tlp/ubuntu xenial main
deb http://ppa.launchpad.net/linrunner/tlp/ubuntu xenial main
deb http://in.archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://in.archive.ubuntu.com/ubuntu/ xenial universe
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://in.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://in.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse

List installed packages in SUSE/openSUSE

To view the list of repositories in SUSE/openSUSE, run:

zypper lr

Or,

zypper repos

Sample output from my openSUSE desktop:

skopensuse@linux:~> zypper lr
# | 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 
skopensuse@linux:~> zypper repos
# | 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 | Ye

List installed repositories in all Linux systems using inxi utility

An another easy way to display the list of repositories is using inxi utility. It will work on most Linux operating systems that supports Inxi. It is free, open source, and full featured command line system information tool. It shows various useful system details, including CPU, drivers, Xorg, Desktop, Kernel, GCC version(s), Processes, RAM usage, and more. It currently supports the following package managers.

  • APT (Debian, Ubuntu, and derivatives)
  • PACMAN (Arch Linux, and derivatives)
  • PISI (Pardus, and derivatives)
  • PORTAGE (Gentoo, Sabayon, and derivatives)
  • PORTS (OpenBSD, FreeBSD, NetBSD, and derivatives)
  • SLACKPKG (Slackware, and derivatives)
  • URPMQ (Mandriva, Mageia, and derivatives)
  • YUM/ZYPP (Fedora, Redhat, Suse, and derivatives)

To list the installed repositories using inxi, run:

inxi -r

Sample output from my Arch Linux system:

Resuming in non X mode: xdpyinfo not found. For package install advice run: inxi --recommends
Repos: Active pacman repo servers in file: /etc/pacman.d/mirrorlist
 http://mirror.hactar.xyz/$repo/os/$arch
 http://archlinux.mirrors.uk2.net/$repo/os/$arch
 http://mirrors.dotsrc.org/archlinux/$repo/os/$arch
 http://ftp.acc.umu.se/mirror/archlinux/$repo/os/$arch
 http://fooo.biz/archlinux/$repo/os/$arch
 http://mirror.csclub.uwaterloo.ca/archlinux/$repo/os/$arch
 http://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch
 http://ftp.sh.cvut.cz/arch/$repo/os/$arch
 http://mirror.js-webcoding.de/pub/archlinux/$repo/os/$arch
 http://mirror.frgl.pw/archlinux/$repo/os/$arch
 http://mirror.internode.on.net/pub/archlinux/$repo/os/$arch
 http://ftp.myrveln.se/pub/linux/archlinux/$repo/os/$arch
 http://mirrors.uni-plovdiv.net/archlinux/$repo/os/$arch
 http://mirror.archlinux.no/$repo/os/$arch
 http://ftp.yzu.edu.tw/Linux/archlinux/$repo/os/$arch
 http://mirror.armbrust.me/archlinux/$repo/os/$arch
 http://mirror.tyborek.pl/arch/$repo/os/$arch
 http://mirror.f4st.host/archlinux/$repo/os/$arch
 http://ftp.nluug.nl/os/Linux/distr/archlinux/$repo/os/$arch
 http://mirror.neuf.no/archlinux/$repo/os/$arch
 Active pacman repo servers in file: /etc/pacman.conf
 http://repo.archlinux.fr/$arch

Was this Tutorial helpful? Help others share on Facebook, Twitter, and Google Plus!

 
Enjoyed this video?
How To Find The List Of Installed Repositories From Commandline In Linux
"No Thanks. Please Close This Box!"