Solution 1:

Here is a script. Without a parameter, the script lists some infos. With --delete, the list files will be removed, if no packages are installed.

#!/usr/bin/env bash
for f in /etc/apt/sources.list.d/*.list; do
    grep -Po "(?<=^deb\s).*?(?=#|$)" "$f" | while read -r ENTRY ; do
    echo "ENTRY: $ENTRY"

    # Sanitize entry line by removing stuff between square brackets
    ENTRY=$(echo "$ENTRY" | sed 's/\[.*\] //')

        HOST=$(cut -d/ -f3 <<< "$ENTRY")

        if [ "ppa.launchpad.net" = "$HOST" ]; then
          USER=$(cut -d/ -f4 <<< "$ENTRY")
          PPA=$(cut -d/ -f5 <<< "$ENTRY")
          packageCount=$(awk '$1=="Package:" {if (a[$2]++ == 0) {system("dpkg -l "$2)}}' /var/lib/apt/lists/*"$USER"*"$PPA"*Packages 2>/dev/null | awk '/^ii/' | wc -l)
          echo "PPA: ppa:$USER/$PPA"
          echo "FILENAME: $f"
          echo "$packageCount package(s) installed"
          if [ "$packageCount" -eq 0 ] && [ "$1" == "--delete" ]; then
            sudo rm "$f" && echo "$f deleted"
          fi
          echo
        else 
          USER=$(cut -d/ -f3 <<< "$ENTRY")
          PPA=$(cut -d/ -f4 <<< "$ENTRY")
          packageCount=$(awk '$1=="Package:" {if (a[$2]++ == 0) {system("dpkg -l "$2)}}' /var/lib/apt/lists/*"$USER"*Packages 2>/dev/null | awk '/^ii/' | wc -l)
          echo "REPOSITORY: $USER/$PPA"
          echo "FILENAME: $f"
          echo "$packageCount package(s) installed"
          if [ "$packageCount" -eq 0 ] && [ "$1" == "--delete" ]; then
            sudo rm "$f" && echo "$f deleted" 
          fi
          echo
        fi
    done
done

Copy the code above in a new file, e.g.:

mkdir -p ~/bin
nano ~/bin/checkPPAs

Make the script executable

chmod +x ~/bin/checkPPAs

And run it with

~/bin/checkPPAs

to list all repositories and the number of installed packages.

Start the script with

~/bin/checkPPAs --delete

to remove the list files.


Sample output on my system

ENTRY: http://ppa.launchpad.net/webupd8team/y-ppa-manager/ubuntu vivid main
PPA: ppa:webupd8team/y-ppa-manager
FILENAME: /etc/apt/sources.list.d/webupd8team-ubuntu-y-ppa-manager-vivid.list
3 package(s) installed

ENTRY: http://ppa.launchpad.net/nilarimogard/webupd8/ubuntu vivid main
PPA: ppa:nilarimogard/webupd8
FILENAME: /etc/apt/sources.list.d/nilarimogard-ubuntu-webupd8-vivid.list
5 package(s) installed

ENTRY: http://ppa.launchpad.net/obsproject/obs-studio/ubuntu vivid main
PPA: ppa:obsproject/obs-studio
FILENAME: /etc/apt/sources.list.d/obsproject-ubuntu-obs-studio-vivid.list
1 package(s) installed

ENTRY: http://archive.getdeb.net/ubuntu vivid-getdeb apps
REPOSITORY: archive.getdeb.net/ubuntu vivid-getdeb apps
FILENAME: /etc/apt/sources.list.d/getdeb.list
7 package(s) installed

ENTRY: http://ppa.launchpad.net/psi-plus/ppa/ubuntu vivid main
PPA: ppa:psi-plus/ppa
FILENAME: /etc/apt/sources.list.d/psi-plus-ubuntu-ppa-vivid.list
15 package(s) installed

ENTRY: http://ppa.launchpad.net/libreoffice/ppa/ubuntu vivid main
PPA: ppa:libreoffice/ppa
FILENAME: /etc/apt/sources.list.d/libreoffice-ubuntu-ppa-vivid.list
24 package(s) installed

ENTRY: https://deb.nodesource.com/node_0.12 vivid main
REPOSITORY: deb.nodesource.com/node_0.12 vivid main
FILENAME: /etc/apt/sources.list.d/nodesource.list
1 package(s) installed

ENTRY: http://dl.google.com/linux/chrome/deb/ stable main
REPOSITORY: dl.google.com/linux
FILENAME: /etc/apt/sources.list.d/google-chrome.list
2 package(s) installed

ENTRY: http://ppa.launchpad.net/gnome3-team/gnome3/ubuntu vivid main
PPA: ppa:gnome3-team/gnome3
FILENAME: /etc/apt/sources.list.d/gnome3-team-ubuntu-gnome3-vivid.list
273 package(s) installed

ENTRY: http://ppa.launchpad.net/noobslab/apps/ubuntu vivid main
PPA: ppa:noobslab/apps
FILENAME: /etc/apt/sources.list.d/noobslab-ubuntu-apps-vivid.list
0 package(s) installed

ENTRY: http://ppa.launchpad.net/ubuntuhandbook1/corebird/ubuntu vivid main
PPA: ppa:ubuntuhandbook1/corebird
FILENAME: /etc/apt/sources.list.d/ubuntuhandbook1-ubuntu-corebird-vivid.list
1 package(s) installed

ENTRY: http://ppa.launchpad.net/webupd8team/unstable/ubuntu vivid main
PPA: ppa:webupd8team/unstable
FILENAME: /etc/apt/sources.list.d/webupd8team-ubuntu-unstable-vivid.list
1 package(s) installed

ENTRY: http://download.mono-project.com/repo/debian wheezy main
REPOSITORY: download.mono-project.com/repo
FILENAME: /etc/apt/sources.list.d/mono-xamarin.list
166 package(s) installed

ENTRY: http://ppa.launchpad.net/otto-kesselgulasch/gimp-edge/ubuntu vivid main
PPA: ppa:otto-kesselgulasch/gimp-edge
FILENAME: /etc/apt/sources.list.d/otto-kesselgulasch-ubuntu-gimp-edge-vivid.list
5 package(s) installed

ENTRY: http://ppa.launchpad.net/numix/ppa/ubuntu vivid main
PPA: ppa:numix/ppa
FILENAME: /etc/apt/sources.list.d/numix-ubuntu-ppa-vivid.list
3 package(s) installed

ENTRY: http://ppa.launchpad.net/webupd8team/atom/ubuntu vivid main
PPA: ppa:webupd8team/atom
FILENAME: /etc/apt/sources.list.d/webupd8team-ubuntu-atom-vivid.list
1 package(s) installed

ENTRY: https://packages.graylog2.org/repo/debian/ trusty 1.0
REPOSITORY: packages.graylog2.org/repo
FILENAME: /etc/apt/sources.list.d/graylog.list
3 package(s) installed

ENTRY: http://ppa.launchpad.net/ubuntu-mate-dev/ppa/ubuntu vivid main
PPA: ppa:ubuntu-mate-dev/ppa
FILENAME: /etc/apt/sources.list.d/ubuntu-mate-dev-ubuntu-ppa-vivid.list
0 package(s) installed

ENTRY: http://ppa.launchpad.net/gnome3-team/gnome3-staging/ubuntu vivid main
PPA: ppa:gnome3-team/gnome3-staging
FILENAME: /etc/apt/sources.list.d/gnome3-team-ubuntu-gnome3-staging-vivid.list
268 package(s) installed

ENTRY: http://debian.koha-community.org/koha stable main
REPOSITORY: debian.koha-community.org/koha stable main
FILENAME: /etc/apt/sources.list.d/koha.list
0 package(s) installed

ENTRY: http://ppa.launchpad.net/pgavin/ghdl/ubuntu trusty main
PPA: ppa:pgavin/ghdl
FILENAME: /etc/apt/sources.list.d/pgavin-ubuntu-ghdl-vivid.list
0 package(s) installed

ENTRY: http://ppa.launchpad.net/ubuntu-mate-dev/vivid-mate/ubuntu vivid main
PPA: ppa:ubuntu-mate-dev/vivid-mate
FILENAME: /etc/apt/sources.list.d/ubuntu-mate-dev-ubuntu-vivid-mate-vivid.list
3 package(s) installed

ENTRY: http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu vivid main
PPA: ppa:webupd8team/sublime-text-3
FILENAME: /etc/apt/sources.list.d/webupd8team-ubuntu-sublime-text-3-vivid.list
1 package(s) installed

ENTRY: http://ppa.launchpad.net/webupd8team/java/ubuntu vivid main
PPA: ppa:webupd8team/java
FILENAME: /etc/apt/sources.list.d/webupd8team-ubuntu-java-vivid.list
1 package(s) installed

ENTRY: http://dl.google.com/linux/chrome/deb/ stable main
REPOSITORY: dl.google.com/linux
FILENAME: /etc/apt/sources.list.d/google.list
2 package(s) installed

ENTRY: http://dl.google.com/linux/chrome/deb/ stable main
REPOSITORY: dl.google.com/linux
FILENAME: /etc/apt/sources.list.d/google-chrome-beta.list
2 package(s) installed

Solution 2:

I don't know of an automatic way, but this method is fairly quick:

  1. Start synaptic package manager and input your password when prompted

  2. In the left column toward the bottom, click on Origin

All the ppas on your system will now be listed at the top of the left column. You can click down the list and see if any software is installed from each. (if there is, there will be a green box by the package name in the right column). If there are many packages from the ppa (too many to see on the screen at once), you can click on the S at the top of the right column to sort them by status.

NOTE: If you have any unused ppas:

  1. Click Settings in the top menu
  2. Then Repositories
  3. Software and Updates window will be displayed.
  4. From this window you can remove the unused ppas from the Other Software tab.