Find what packages are installed from a repository

In brackets, you should use only the name of the repository, not the URI or something else. For example in your case:

aptitude search "?origin (ubuntu-wine) ?installed"

Run apt-cache policy to see the repositories and the names (aka origin, o) of those:

$ apt-cache policy | grep wine
 500 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu xenial/main i386 Packages
     release v=16.04,o=LP-PPA-ubuntu-wine,a=xenial,n=xenial,l=Wine Team PPA,c=main,b=i386
 500 http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu xenial/main amd64 Packages
     release v=16.04,o=LP-PPA-ubuntu-wine,a=xenial,n=xenial,l=Wine Team PPA,c=main,b=amd64

Since the search string is a regex pattern matched anywhere in the string, you can use a convenient substring like ubuntu-wine, or even just wine.

See also: How can I get a list of all repositories and PPAs from the command line into an install script?


Here is a shell script I wrote to display packages installed from different origins excluding Ubuntu. It uses common dpkg -l output format. It works faster than aptitude solutions.

#!/bin/sh

# Print packages installed from different origins.
# Exclude standard Ubuntu repositories.

grep -H '^Origin:' /var/lib/apt/lists/*Release | grep -v ' Ubuntu$' | sort -u \
| while read -r line; do
    origin=${line#* }    
    echo $origin:
    
    list=${line%%:*}
    sed -rn 's/^Package: (.*)$/\1/p' ${list%_*Release}*Packages | sort -u \
    | xargs -r dpkg -l 2>/dev/null | grep '^.i '
    echo
 done

Note that there may also be installed packages that have no such origin available, see this to find them.


Origin is not URL of repository. To find Origin of repository look for file in /var/lib/apt/lists/ ending with Release.

For example

grep "Origin" /var/lib/apt/lists/linux.dropbox.com_debian_dists_wheezy_Release

Will show:

Origin: Dropbox.com

So aptitude search "?origin(dropbox.com) ?installed" will show me installed package from dropbox repository.