What is the main difference between ppa-purge and add-apt-repository -r. Which one better clear residual items and reason to use one over another? Does add-apt-repository -r should do what ppa-purge do?

Edit: Also do both remove key from apt's keyring?

2 Answers 2


For what I understand, the difference is what they do after removing the PPA.

ppa-purge - Disables a PPA and reverts to the official packages if applicable. For example, if I added the xorg-edgers PPA and installed the Nvidia drivers, if I do a ppa-purge on said PPA, it would not only disable the xorg-edgers PPA but also revert the NVIDIA drivers from the one in the PPA to the official ones found on the official Ubuntu repositories.

add-apt-repository -r - Will only remove the said PPA. Will not revert any packages.

The case scenarios might be:

  • When you want to keep a package from a PPA but want to remove the actual PPA. For example, if you wanted to add the Ubuntu Tweak Package from a PPA but then wanted to remove the PPA, you would use add-apt-repository which will leave Ubuntu Tweak installed.

  • When you want to go back to an official package and stop using a PPA that has updated/experimental packages (Like Kernel version packages, Proprietary packages...). In this cases you might want to use ppa-purge assuming your intention is to go back to the official versions. Which is the same as removing each PPA package installed and then doing:

    sudo apt-get update  
    sudo apt-get upgrade
    sudo apt-get install PACKAGES

For most cases, add-apt-repository should be enough to add and remove PPAs. The use of ppa-purge can only help in the small cases where you want to actually remove a package and install the official version which is not common since most user add a PPA to have something better than the one that comes with Ubuntu. Cases like kazam (From Kazam PPA), Proprietary Video drivers (From swat-x or xorg-edgers PPA), and even the Google Chrome and VirtualBox ones. And even if they remove it, it is only 2 or 3 commands to remove the current packages from the removed PPA and install the official ones.

With all of this in mind, it simply comes down to what the user wants to do about the packages related to the PPA.

  • Does that mean that there is no need of ppa-purge if I use a repo to install pkg that is not available in official repo, say like "ubuntu-tweak", since there is no pkg to revert to official pkg?
    – Alinwndrld
    Jun 19, 2013 at 3:04
  • @Alinwndrld Will update answer. Jun 19, 2013 at 3:08
  • 1
    @LuisAlvarado Minor spelling mistake: sudo apt-get ugprade :) Jun 25, 2013 at 9:33
  • @Alinwndrld At least development version of ppa-purge removes the packages in that case. You could also test my version of ppa-purge, which includes many improvements. It can also remove other repositories than PPAs, so maybe it would be better to call it remove-apt-repository.
    – jarno
    Nov 28, 2016 at 9:25
  • Updated link of the above comment here.
    – Carolus
    Feb 17, 2021 at 22:27

The apt-add-repository manpage says this about the command:

   REPOSITORY can  be  either  a  line  that  can  be  added  directly  to
   sources.list(5),  in the form ppa:<user>/<ppa-name> for adding Personal
   Package Archives, or a distribution component to enable.

   In  the   first   form,   REPOSITORY   will   just   be   appended   to

   In  the second form, ppa:<user>/<ppa-name> will be expanded to the full
   deb  line  of  the  PPA  and   added   into   a   new   file   in   the
   /etc/apt/sources.list.d/  directory.   The  GPG public key of the newly
   added PPA will also be downloaded and added to apt's keyring.

   In the third form, the given distribution component will be enabled for
   all sources.  


-r, --remove Remove the specified repository  

So add-apt-repository just adds and removes lines from /etc/apt/sources.list and /etc/apt/sources.list.d/.

The ppa-purge manpage says this:

       ppa-purge - disables a PPA and reverts to official packages

       This script provides a  bash  shell  script  capable  of  automatically
       downgrading all packages in a given PPA back to the ubuntu versions.

       You  have  to  run  it  using  root  privileges  because of the package

So ppa-purge will not only remove a PPA, it will also downgrade any packages back to their default versions. This is useful when testing beta or newer versions of software.

  • Does both remove ppa key from apt's keyring?
    – Alinwndrld
    Jun 19, 2013 at 3:04
  • @Alinwndrld It should.
    – Seth
    Jun 19, 2013 at 3:17
  • @Alinwndrld see here. As for ppa-purge, currently not. Are the keys harmful there?
    – jarno
    Nov 28, 2016 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.