Software

How to easily purge unwanted repositories in Linux

If superfluous repositories are slowing down your system, it's time to clean house. Here's a simple way to remove unwanted or broken repos from your Linux distribution.

After a year of so of working with Ubuntu Linux (or derivative such as Elementary OS), I almost always find myself with a number of repositories from software I may have installed and removed or never really needed in the first place. That means /etc/apt/sources.d can get pretty crowded and the apt update process becomes a bit sluggish. Or worse, repositories can become broken, bringing apt update to halt. Because of this, I try hard to keep those repositories to a minimum. One way to do this is to simply open a terminal window and comb through that directory (deleting any unnecessary .list file).

Sure, you can install the third-party ppa-purge tool, but with that you must know the official name of the repository. I don't know about you, but after installing a PPA, the official name escapes me moments later. Fortunately, there's an easier way—one that's already built into the distribution. Those who would rather deal with the command line as little as possible will find this tool incredibly easy to use.

Let me show you how to remove repositories from your Linux distribution, with the help of a user-friendly GUI.

The tool in question

The tool I want to introduce you to, software-properties-gtk, is found on many flavors of Linux. If your distribution uses the GNOME desktop, you'll find a Software Repositories tool tucked away in GNOME Software. In some distributions, the tool is installed regardless of what app store is used. If your distribution uses KDE, this same process can be handled in the Discover app under Settings.

For the sake of simplicity, I'll be demonstrating on Ubuntu 18.04. The process for removing repositories is similar in most distributions that offer a GUI for the task. Once familiar with software-properties-gtk, you should be able to easily take care of removing repositories on most distributions.

SEE: IT pro's guide to working smarter with Linux (Tech Pro Research)

Removing repositories

On Ubuntu Linux, you can get to the tool in two ways:

  • From the command line
  • From within Ubuntu Software (aka GNOME Software)

The command to open the tool is (as you might have expected) software-properties-gtk. If you don't want to mess with the command line, open Ubuntu Software, click on the menu (it appears in the top bar of the desktop), and select Software & Updates.

After the tool opens, you'll see six tabs (Figure A).

Figure A

Figure A

The software-properties-gtk app in action.


The tab you want to work with is Other Software. Click on that and you'll see all of the third-party repositories you've added (Figure B).

Figure B

Figure B

Only a few repos have been added to this Ubuntu 18.04 virtual machine.

For the sake of comparison, I opened up the software-properties-gtk tool on my Elementary OS desktop (which I've been using for more than a year). The number of third-party repositories is significant (Figure C).

Figure C

Figure C

A large number of third-party repositories have been added to my Elementary OS desktop.


To remove repositories, you only have to scroll through the list and uncheck those you don't want included. Initially, you will be prompted for your sudo password. After that, you should be able to comb through the added repositories (removing as needed) without having to type that password again. If you have as many repositories on your machine as I do, you'll find that every time you uncheck a repo, software-properties-gtk might well scroll back to the top of the list. This is annoying, but not a deal breaker. After you've gone through the list, click the Close button. You'll then be prompted to reload the information about the available software (aka apt update). Do this, and once the update finishes, software-properties-gtk will close. You're finished. You've successfully cleaned up your repositories.

SEE: How to find files in Linux with grep: 10 examples (free TechRepublic PDF)

Keep it clean

If you like to keep your system clean and running efficiently, consider this a must-do (especially after using the operating system for an extended period). Repositories can add up and the more you have, the longer the update process can be. So if there are repositories for software you don't use anymore (or repositories that are broken), get rid of them. Your system will thank you by running more efficiently.

Also See

linuxhero.jpg
Image: Jack Wallen

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks

Free Newsletters, In your Inbox