Hello Linux Geeksters. As you may know, both ppa-purge and add-apt-repository -r are used for removing added PPAs, but the the two behave different.
In this article I will show you the difference between the ppa-purge and add-apt-repository -r commands. This guide works Ubuntu, Linux Mint, Elementary OS and all their derivative systems that know how to handle PPAs.
The “add-apt-repository -r” command disables some repository, but does not do anything with the packages installed from it
While add-apt-repository adds PPAs to the system, add-apt-repository -r disables the PPA from /etc/apt/sources.list or /etc/apt/sources.list.d/* but does not do anything with the packages installed from the PPA.
Usage example:
How to enable the “ppa:test/ppa” PPA (and update the local repository index, in order to apply the changes):
$ sudo add-apt-repository ppa:test/ppa
$ sudo apt-get update
How to disable the “ppa:test/ppa” PPA and update the local repository index, in order to apply the changes:
$ sudo add-apt-repository -r ppa:test/ppa
$ sudo apt-get update
The “ppa-purge” command disables the repository and reverts/downgrades all the packages installed from the PPA to the original versions:
When you remove a PPA via ppa-purge, all the packages installed from the PPA are uninstalled and the official packages are installed again.
Usage example:
Add the “ppa:test/ppa” PPA via add-apt-repository:
$ sudo add-apt-repository ppa:test/ppa
$ sudo apt-get update
Remove the ppa and revert the packages installed via the ppa to the versions from the official repos:
$ sudo apt-get install ppa-purge
$ sudo ppa-purge ppa:test/ppa
OK, but when to use ppa-purge and when to use add-apt-repository -r?
I disable PPAs via add-apt-repository -r when I have just installed some packages from the PPA, but don’t want other packages to be updated, via that repository.
I use ppa-purge when I want to replace some unstable/experimental packages I have installed via PPA, with the packages from the official repositories.