As you probably know, tons of software can be installed in Ubuntu 20.04 right from the command line via
apt or from the Ubuntu Software application on Ubuntu's desktop. The way this works is that Ubuntu will query a repository which contains links to the various software you may wish to install. It searches for the package you specify, and then downloads and installs it.
Although Ubuntu's default package archive contains some of the most common software people need, a lot of times it's necessary to install a package using a PPA repository. No problem there, except these PPA repositories don't remove themselves unless you do it manually. After a while, your system could be querying a lot of irrelevant PPA repositories every time you install or update software. In this guide, we'll show you how to list and delete the PPA repositories on Ubuntu 20.04 Focal Fossa.In this tutorial you will learn:
- How to list PPA repositories via command line
- How to remove PPA repositories via command line
- How to list and remove PPA repositories via GUI
|Category||Requirements, Conventions or Software Version Used|
|System||Installed Ubuntu 20.04 or upgraded Ubuntu 20.04 Focal Fossa|
|Other||Privileged access to your Linux system as root or via the
# - requires given linux commands to be executed with root privileges either directly as a root user or by use of
List PPA repositories via command line
You can list all of the available repositories on a Ubuntu 20.04 system by opening a terminal and typing the following command:
$ apt policy
We have one PPA repository on our system, which is for Java. The
apt policy command will output PPA repositories first, so look at the beginning of the output to see all of the PPA repositories on your system. Listed below the PPA repositories are just the default package archives that Ubuntu always uses.
Remove PPA repository via command line
Once you determine the name of a PPA repository with
apt policy that you wish to remove, you can use the following command syntax to get rid of it:
$ sudo add-apt-repository --remove ppa:PPA_REPOSITORY_NAME/PPA
The Java repository on our system is
linuxuprising/java, so we'd remove it with this command:
$ sudo add-apt-repository --remove ppa:linuxuprising/java
After issuing the remove command, you can check with
apt policy to make sure the PPA no longer appears in the list.
List and remove PPA repository via GUI
If you have access to a GUI on your Ubuntu 20.04 system, then this method is even easier. To list and remove PPA repositories via GUI, first open the Software & Updates application from Ubuntu's application launcher.
Click on the "Other Software" tab to get a list of the PPA repositories. Like before, the only PPA repository we have on our system is for Java:
To remove a PPA repository, all you need to do is highlight a listed PPA and click remove.
That's all there is to it. You can close the Software & Updates application when you are finished, and the changes will be saved on your system.
In this article, we learned how to list and remove PPA repositories via command line or GUI on Ubuntu 20.04 Focal Fossa. Removing irrelevant PPA repositories from your system is good practice, as it prevents your package manager from becoming convoluted with unnecessary package archives.