4 Easy Methods To Remove an APT Repository in Ubuntu

Remove Repository Featured Image

In this article, we’ll cover the simple steps to remove an apt repository in Ubuntu. While updating the Ubuntu system using the apt command, we may come across a scenario where some old repositories cause errors. The only feasible option that remains is to remove such repositories. In this article, we will demonstrate command-line as well as GUI methods to remove an apt repository or PPAs (Personal Package Archives).

How to remove an apt repository in Ubuntu

Let’s go over the steps that you’d need take to remove an apt repository.

1. Using the apt command

This might not come to a surprise to any Ubuntu user, that this task can be achieved by using the all powerful apt command. It can be done by:

sudo add-apt-repository --remove ppa:<PPA_NAME>
Remove Repository Apt
Remove PPA using ‘apt’ command

To remove a specific repository, we need to know the exact name of the PPA involved. Not every user is aware of the names of the repository present on the system, therefore Ubuntu has a command to list the repositories.

apt policy
Remove Repository Apt Policy
Remove Repository Apt Policy

The number before the name of repository is a priority number.

2. Using the ppa-purge command

As the name of the command name suggests, it specifically deals with removing repositories in Linux systems. Since this is not a system built-in function, we’ll install the package using the apt command:

sudo apt install ppa-purge

After installing the tool, we can run:

sudo ppa-purge ppa:<PPA_NAME>
Remove Repository Purge
Removing repository by ‘ppa-purge’

3. Removing a repository from ‘apt directory’

Like every other configuration in Linux, repositories are stored in the system as a file. Instead of using predefined commands, we can remove these repositories manually.

These repositories are stored in 'etc/apt/source.list.d/' in the form of '.list' files. Before removing any repository, we can list the contents of the directory by using the ls command:

Remove Repo Source Ls
Files inside ‘source.list.d’

The 'ls' command is used to display the contents of any directory in a Linux system. We have a complete documentation on ls command. From the repository files we can choose the ones we wish to remove.

According to the permissions displayed at the start of each line, we need elevated privileges to remove these files:

 sudo rm /etc/apt/sources.list.d/<Repo_Filename>.list
Remove Repo Source File
Removing repository manually

The 'rm' command is responsible for removing files from command line.

This basically sums up all the ways to remove repositories using the command-line.

4. Removing a repository using ‘Software and Updates’

There is no easier method to remove a repository than using a GUI-based application. To do the required, we open “Software and Updates” in Ubuntu.

In the “Other Software” section of the application, we can see a list of repositories in Ubuntu.

Remove Repo GUI1
Software and Updates application

Selecting and pressing the “Remove” button will bring up the “Authentication” screen.

Remove Repo GUI2
Authentication Screen

After entering the password and clicking “Authenticate”, we are done with dealing with the specific repository.


The task of removing any repository is not difficult. The Graphic-based method is very convenient and saves time. Yet, there is no harm in learning about new things and commands in Linux. We hope this article solved any repository issues of the reader.

Feel free to comment below in case we missed any method to remove a repository in Ubuntu.