Site icon DesignLinux

How to List Installed Repositories on Ubuntu & Debian

How to List Installed Repositories In Ubuntu & Debian

In Linux, a collection of packages knowns as repository. You can make a common repository with the actual package and connect your other systems with this central repository. After that you can install and update packages from there. In this tutorial, we will show you how to list all installed repositories on Ubuntu and Debian based systems.

All Debian based systems like Ubuntu, etc. are using the APT as package manager. You can find the configuration files of Apt at the /etc/apt directory.

List Installed Repositories In Ubuntu

The /etc/apt/sources.list file contains the references of the remote repositories and files are stored at /etc/apt/sources.list.d/ directory.

To list all the configured repositories on apt, you would run the following command:

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

It will show the output something like this:

deb http://mirrors.digitalocean.com/ubuntu/ bionic main restricted
deb http://mirrors.digitalocean.com/ubuntu/ bionic-updates main restricted
deb http://mirrors.digitalocean.com/ubuntu/ bionic universe
deb http://mirrors.digitalocean.com/ubuntu/ bionic-updates universe
deb http://mirrors.digitalocean.com/ubuntu/ bionic multiverse
deb http://mirrors.digitalocean.com/ubuntu/ bionic-updates multiverse
deb http://mirrors.digitalocean.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse
deb https://repos.insights.digitalocean.com/apt/do-agent main main
deb http://ppa.launchpad.net/certbot/certbot/ubuntu bionic main
deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted
deb http://security.ubuntu.com/ubuntu/ bionic-security universe
deb http://security.ubuntu.com/ubuntu/ bionic-security multiverse

Another way is use apt-cache command to list all repositories. There is nothing difference but this command will provide information in details.

Run the below command:

sudo apt-cache policy 
Package files:
 100 /var/lib/dpkg/status
     release a=now
 500 https://repos.insights.digitalocean.com/apt/do-agent main/main amd64 Packages
     release o=. main,a=main,n=main,l=. main,c=main,b=amd64
     origin repos.insights.digitalocean.com
 500 http://ppa.launchpad.net/certbot/certbot/ubuntu bionic/main amd64 Packages
     release v=18.04,o=LP-PPA-certbot-certbot,a=bionic,n=bionic,l=Certbot PPA,c=main,b=amd64
     origin ppa.launchpad.net
 500 http://security.ubuntu.com/ubuntu bionic-security/multiverse amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=multiverse,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/restricted amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=restricted,b=amd64
     origin security.ubuntu.com
 500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-security,n=bionic,l=Ubuntu,c=main,b=amd64
     origin security.ubuntu.com
 100 http://mirrors.digitalocean.com/ubuntu bionic-backports/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin mirrors.digitalocean.com
 100 http://mirrors.digitalocean.com/ubuntu bionic-backports/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-backports,n=bionic,l=Ubuntu,c=main,b=amd64
     origin mirrors.digitalocean.com
 500 http://mirrors.digitalocean.com/ubuntu bionic-updates/multiverse amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=multiverse,b=amd64
     origin mirrors.digitalocean.com
 500 http://mirrors.digitalocean.com/ubuntu bionic-updates/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin mirrors.digitalocean.com
 500 http://mirrors.digitalocean.com/ubuntu bionic-updates/restricted amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=restricted,b=amd64
     origin mirrors.digitalocean.com
 500 http://mirrors.digitalocean.com/ubuntu bionic-updates/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic-updates,n=bionic,l=Ubuntu,c=main,b=amd64
     origin mirrors.digitalocean.com
 500 http://mirrors.digitalocean.com/ubuntu bionic/multiverse amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=multiverse,b=amd64
     origin mirrors.digitalocean.com
 500 http://mirrors.digitalocean.com/ubuntu bionic/universe amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=universe,b=amd64
     origin mirrors.digitalocean.com
 500 http://mirrors.digitalocean.com/ubuntu bionic/restricted amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=restricted,b=amd64
     origin mirrors.digitalocean.com
 500 http://mirrors.digitalocean.com/ubuntu bionic/main amd64 Packages
     release v=18.04,o=Ubuntu,a=bionic,n=bionic,l=Ubuntu,c=main,b=amd64
     origin mirrors.digitalocean.com
Pinned packages:

Conclusion

I hope you have learned how to get the list of all the repositories configured on Ubuntu or Debian based system.

If you have any questions or feedback, please leave comment below.

Exit mobile version