How to Remove APT Repositories in Linux? [2 Easy Methods]

A key attribute of Linux is enabling you to create repositories if you want to access either official or third-party software in your system. But have you ever thought about how you get rid of those repositories once they meet your needs? On top of that, removing old repositories provide faster updation of the system without errors. So, in this article, I will show you several ways to remove apt repositories from your Linux system.

Key Takeaways

  • Removing Repositories Using CLI.
  • Learning Repository Removal Manually from the Source apt Directory.
  • Using GUI to Delete Repository.


Process Flow Chart

[Distro Used Throughout the Tutorial: Ubuntu 22.04]Process flowchart of removing apt repsitories where removal process using GUI and CLI are shown via block diagrams.

2 Methods to Remove APT Repositories on Ubuntu

There are various ways to remove apt repositories in Ubuntu. Here, I have mentioned 2 effective methods (using CLI and GUI).

You can read our Comparative Analysis of Methods to distinguish between these two methods and pick the best one for your need.

Method 01: Using CLI (Command Line Interface) to Remove APT Repositories

You can undo the addition of any repository from the command line. The process is very simple requiring only a few commands. Now, I will walk you through two different approaches with practical demonstration.

A. Utilizing apt-add-repository Command for Deleting Repository

You can delete a repository using a very straightforward command.

Steps to Follow >

➊ First, open your Ubuntu terminal. You can try, the shortcut: CTRL+ALT+T.

➋ Now, type the following command.

apt-add-repository --list
  • apt-add-repository: It is used for adding or deleting a repository.
  • –list: An option returning the list of current repositories available to the apt package manager.

➌ After that, press the ENTER button.the command showing current apt repositoriesYou should see the list of current repositories on your system like the picture above.

Now, you can remove any repository you find not useful. For example, I will remove deb wiley-getdeb games repository from my system. Now, to do the same for your intended repository, follow the below steps.

➍ Type the below-mentioned command.

sudo apt-add-repository --remove deb wiley-getdeb games
  • sudo: Prefix used to get sudo/root privileges.
  • apt-add-repository: Main command for adding/deleting repository.
  • –remove: Option telling the command to remove repository.
  • deb wiley-getdeb games: Repository url to be deleted.

➎ Now, hit ENTER.

At this point, you will be asked to give your user account password to access the sudo privilege like the following snapshot.selected repository is being removed using the apt-add-repository command with remove option➏ Type the password and hit the ENTER key.

➐ Now, type the command mentioned below:

sudo apt update
  • sudo: Provides root privileges.
  • apt: Tool for managing packages in the user’s system.
  • update: Updates software packages.

apt repository list is updated after removal of repository➑ Now, provide your root password and press ENTER.

➒ Again, type the following command.

apt-add-repository --list

➓ Finally, hit the ENTER key.after updation, the existing repositories are shownHere, you can spot that my system doesn’t contain the apt repository namely deb wiley-getdeb games. This implies that I have successfully removed the repository.

B. Removing an APT Repository from the “Source APT Directory”

The system directory named (/etc/apt/sources.list.d/) handles the management of repositories. So, you can remove any unnecessary repository by simply modifying the  sources.list file located in that directory since it is the principal apt source configuration file.

Steps to Follow >

➊ First, press CTRL+ALT+T to redirect to your Ubuntu terminal.

➋ Type the following command.

apt-add-repository --list

➌ Press ENTER.the method of listing repositories via command➍ Now, type the command mentioned below:

nano /etc/apt/sources.list
  • nano: Command used to open and edit files in the nano text editor.
  • /etc/apt/sources.list: File to be edited.

the nano command showing the apt repository urls In the above image, you see the sources.list file is now open on the text editor where you can further notice the list of repositories.

➎ Now, remove the entire line of the repository name you want to remove by pressing the BACKSPACE button. For instance, I will remove the repository named deb wiley-getdeb games.the url of the selected repository is being removed➏ After that, press CTRL+S to save and then CTRL+X to exit the file.

➐ Again, type the following command.

apt-add-repository --list

➑ Finally, press the ENTER button to see the updated list of repositories.the listing of repositories after removing url from nano text editorIn the image, I have fetched the repositories and you see the wiley-getdeb games repository has been removed.

Method 02: Using GUI (Graphical User Interface) to Remove APT Repositories

You may want to use the GUI(Graphical User Interface) to remove repositories. The process is very straightforward as follows:

Steps to Follow >

➊ First, go to your applications menu and type Software & Updates.typing and then going to software and updates section in settings➋ Now, click on the Software & Updates app and select the Other Software, in other software, the repositories are listed➌ Click to select the repository you want to remove from your machine.

➍ Then, click on the Remove button and after that hit the Close button.repository is being selected, removed and closed➎At this point, click on the Reload button to update the repository information.asks to reload for systems' apt repository log updation after removalFinally, in the following snapshot, you can see that only the selected repository has been removed and the remaining ones are shown after updating.via GUI, the current repositories are listed

Comparative Analysis of Methods

The following table gives an essence of the aforementioned methods as far as the apt repository deletion is concerned.

Methods Pros Cons
Method 1
  • Simple and easy
  • Direct access to the source file
  • Compatible with distributions
  • Limited functionality
  • Permission is required for file modification
  • Can be overwhelming for novice users

Method 2

  • The easiest method
  • User-friendly
  • Pron to less error
  • Manual process
  • Less efficacious in terms of repository management

The picking of methods depends on several factors such as the beginner may find the visual representations of GUI(method 2) more perceivable. On the contrary, experienced users would advocate the use of command line and source file editing(method2) considering the level of performance and control appeal to them more. Every method works just fine. Henceforth, they are left to your personal choice.

Common Challenges That May Arise During Repository Configuration in Linux

Foremost, in the second method, I displayed removing apt repositories using GUI. It is the easiest method of the lot. However, an issue takes place while the execution.In deleting apt repositories using GUI, authentication is necessary where the user password is givenAfter pressing the Remove button, you get an alert saying Authentication Required like the aforementioned snapshot. Here, providing the user account password for authentication smoothly resolves the issue and removes the selected repository in consequence.

Secondly, in method 1(B), I exhibited removing an apt repository by modifying the sources.list file. But after accessing the file running nano /etc/apt/sources.list command, you might not be able to remove the repositories’ package reference url since you lack the write permission.the source apt repository file is not writtableIn the above screenshot, it’s seen that I am denied writing permission when attempting to remove the package link deb http://repo.tld/ubuntu distro component.

Don’t let yourself get overwhelmed by the situation. Just alter the permission of the file named sources.list.

Steps to follow >

➊ First, open your Ubuntu Terminal.

➋ Now, type the following command

sudo chmod a+w /etc/apt/sources.list
  • sudo: Prefix used to get sudo/root privileges.
  • chmod: Command used to change permission.
  • a+w: Grants write permission to all the users.
  • /etc/apt/sources.list: The file which is modified for repository configuration.

➌ After that, type the following command to see the permission details

ls -l /etc/apt/sources.list
  • ls -l: This command returns the detailed list of contents of the current working directory.

using mode changing command for writing permission enablingIn the above image, you can see that all the users are granted permission to write the file. Finally, you are good to go.


In this feature, I have discussed the removal processes of repositories along with providing multiple pragmatic examples. Using these methods, you can easily remove the repository from your system that you no longer require. I hope that the hands-on experience will aid your learning of repository management and take you one step further in becoming a Linux power user.

People Also Ask

How to remove the APT package in Linux?
You can remove the apt package in Linux by typing and running the apt remove command followed by the package_name you intend to remove. Remember, you will be asked to press ‘Y’ to confirm the package removal.

How to list all the installed APT packages in Linux?
Listing the installed apt packages is straightforward and is retrieved by running the “apt list – -installed” command. This will also print the current version of enlisted software on your system.
How to clean APT Cache in Ubuntu?

The apt clean command clears the cache by removing everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial/.

What is the full form of APT in Linux?
APT stands for Advanced Package Tool which provides a set of tools used for installing, updating, removing, and managing software packages on Debian-based operating systems such as Linux Mint and Ubuntu.

Related Articles

<< Go Back to Repository Configuration in Linux | Package Management in Linux | Learn Linux Basics

Rate this post
Md Masrur Ul Alam

Assalamu Alaikum, I’m Md Masrur Ul Alam, currently working as a Linux OS Content Developer Executive at SOFTEKO. I completed my Bachelor's degree in Electronics and Communication Engineering (ECE)from Khulna University of Engineering & Technology (KUET). With an inquisitive mind, I have always had a keen eye for Science and Technolgy based research and education. I strongly hope this entity leverages the success of my effort in developing engaging yet seasoned content on Linux and contributing to the wealth of technical knowledge. Read Full Bio

Leave a Comment