How to get a list of all installed repositories and PPAs on Ubuntu

Question: I configured so many third-party repositories and PPAs on my Ubuntu system that I lost their count. How can I get a list of all repositories and PPAs configured on my Ubuntu?

To view all available repositories and PPAs configured on Ubuntu, you can use apt-cache command. This command is typically used to query local APT package cache to obtain various package/repository related meta data.

In particular, used with policy option, apt-cache command retrieves priorities associated with each repository resource. From its output, you can infer a list of all available repositories and PPAs.

For example:

$ apt-cache policy

The above output shows a list of repository sources and their priorities (first column). This output lists duplicate sources (e.g., for 32-bit and 64-bit packages).

To discount the duplicates and get a more human-readable list of repositories, you can refine the above output as follows.

$ apt-cache policy | grep http | awk '{print $2 $3}' | sort -u

As exemplified above, the repository list includes third party repositories, PPAs and base repositories.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

Leave a comment

Your email address will not be published. Required fields are marked *