Ubuntu Linux Remove / Delete PPAs apt-get command

last updated in Categories , , ,

Over time I have added way too many PPAs using the add-apt-repository command on Ubuntu Linux 16.04/18.04 LTS server for testing purpose. How can I delete or remove those PPAs? Is there a command to list all PPAs?

Yes, you can delete or remove a PPA in Ubuntu Linux. You must have root privileges to achieve this task. This page explains how to Remove PPAs in Ubuntu Linux using various command line options.


What is a PPA?

A PPA is an acronym for Personal Package Archive. It is nothing but pre-built binary software repository for apt packages. The author uploads source code and packages are built online using Launchpad.

How do I add a PPA and install a package?

The syntax is:
sudo add-apt-repository ppa:name/her
sudo apt update
sudo apt install package

For example, install a simple animated GIF screen recorder called peek using PPA:
$ sudo add-apt-repository ppa:peek-developers/stable
$ sudo apt update
$ sudo apt install peek

How to list all installed PPAs

Type the following command:
$ grep ^ /etc/apt/sources.list.d/*
Sample outputs:

Fig.01: Ubuntu Linux list all installed PPAs command
Fig.01: Ubuntu Linux list all installed PPAs command

Ubuntu Linux Remove PPAs

The syntax is:
sudo add-apt-repository --remove ppa:name/here
To remove PPA named ppa:gluster/glusterfs-3.9. However, before removing PPA delete all packages installed from the same PPA using apt-get command/apt command:
$ sudo apt-get --purge remove glusterfs-server
$ sudo apt-get --purge autoremove

Now delete PPA:
$ sudo add-apt-repository --remove ppa:gluster/glusterfs-3.9
Sample outputs:

 This archive is EOL. Please use a supported version.
 More info: https://launchpad.net/~gluster/+archive/ubuntu/glusterfs-3.9
Press [ENTER] to continue or ctrl-c to cancel removing it

Finally update your repo:
$ sudo apt-get update
Sample outputs:

Hit:1 http://ppa.launchpad.net/saiarcot895/myppa/ubuntu xenial InRelease
Hit:2 http://download.nus.edu.sg/mirror/mariadb/repo/10.1/ubuntu xenial InRelease         
Get:3 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]                     
Hit:4 http://mirror.lstn.net/mariadb/repo/10.1/ubuntu xenial InRelease                                    
Hit:5 http://in.archive.ubuntu.com/ubuntu xenial InRelease              
Hit:6 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease
Get:7 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Fetched 204 kB in 1s (185 kB/s)    
Reading package lists... Done

Say hello to ppa-purge tool

The ppa-purge tool is nothing but a bash shell script capable of downgrading all packages in a given PPA back to the original Ubuntu versions. It disables a PPA. First install ppa-purge:
$ sudo apt-get install ppa-purge
Sample outputs:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 6,312 B of archives.
After this operation, 24.6 kB of additional disk space will be used.
Get:1 http://in.archive.ubuntu.com/ubuntu xenial/universe amd64 ppa-purge all 0.2.8+bzr63 [6,312 B]
Fetched 6,312 B in 0s (24.2 kB/s)
Selecting previously unselected package ppa-purge.
(Reading database ... 92785 files and directories currently installed.)
Preparing to unpack .../ppa-purge_0.2.8+bzr63_all.deb ...
Unpacking ppa-purge (0.2.8+bzr63) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up ppa-purge (0.2.8+bzr63) ...

ppa-purge syntax

The syntax is:
$ sudo ppa-purge ppa:repo-name/dirname
For example, remove apt-fast command repo that is used to speed up apt-get on Ubuntu Linux:
$ sudo ppa-purge ppa:saiarcot895/mypp
Sample outputs:

Fig.02: Delete PPAs using ppa-purge script
Fig.02: Delete PPAs using ppa-purge script

To remove https://launchpad.net/~saiarcot895/+archive/ubuntu/myppa you can use following syntax too:
$ sudo ppa-purge -o myppa
$ sudo ppa-purge -o saiarcot895 -p myppa


	-p [ppaname]		PPA name to be disabled (default: ppa)
	-o [ppaowner]		PPA owner
	-s [host]		Repository server (default: ppa.launchpad.net)
	-d [distribution]	Override the default distribution choice.
	-y 			Pass -y --force-yes to apt-get or -y to aptitude
	-i			Reverse preference of apt-get upon aptitude.
	-h			Display this help text

Ubuntu Linux Delete PPAs

In this final example you are going to learn how to remove or delete PPA for ansible in Ubuntu:
sudo ppa-purge -o ansible


You learned how to remove PPAs under Ubuntu Linux using command line options.

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.


5 comment

  1. Good job! But I am inquiring. When I delete a PPA will be deleted and its dependencies? If the answer is “yes”, what happens if those dependencies are used by other PPAs? And they are also deleted? Thank you!

  2. Good job! But I am inquiring. When I delete a PPA will be deleted and its dependencies? If the answer is “yes”, what happens if those dependencies are used by other PPAs? And they are also deleted? Thank you!

  3. Removing a ppa does not remove packages, just the abilty to update any packages you may have installed from that ppa, with system updates.
    ppa-purge will disable a ppa and revert installed packages from that ppa to official packages or remove if not official packages.
    ppa-purge will prompt before removing or downgrading packages.
    Best practice is to use ppa-purge.

    It’s up to you to know(find out) if a package is dependant on a particular version of another package from a ppa or if it is compatible with the official downgraded version.

    This is a handy one-liner to show installed third party ppas in form that can be used with ppa-purge.
    for PPA_FILE in $(ls /etc/apt/sources.list.d/*.list); do cat ${PPA_FILE} | egrep -v '^#|^ *$' | grep "ppa.launchpad.net" | cut -d "/" -f4-5; done

Leave a Comment