11

I'm trying to find what packages I have installed from a repository using terminal commands.

I found a post somewhere saying I could use aptitude search "?origin (<repository>) ?installed", but I couldn't get it working. I tried searching for a packages that came from ppa:ubuntu-wine/ppa and got nothing with these:

aptitude search "?origin (http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu/) ?installed"
aptitude search "?origin (http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu/) ?installed"
aptitude search "?origin (http://ppa.launchpad.net/ubuntu-wine/ppa/ubuntu/ raring/main) ?installed"

It would be nice if I could get something that works with PPAs.

10

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?

  • 1
    Thanks, that made the command work and it got me what I was looking for. – Enkouyami Sep 7 '13 at 16:56
  • This did not list packages for me: aptitude search "?origin (multiverse) ?installed" - shouldn't it? ("multiverse" is enabled) – Volker Siegel Apr 23 '14 at 8:13
  • @VolkerSiegel no, but use aptitude search "?section (multiverse) ?installed", instead. – jarno Apr 5 '18 at 11:46
4

Here is a Bash 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/bash

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

grep '^Origin:' /var/lib/apt/lists/*Release | grep -v ' Ubuntu$' | sort -u \
| while read -r line; do
    origin=$(cut -d' ' -f2- <<<"$line")    
    echo $origin:

    list=$(cut -d: -f1 <<<"$line")
    sed -rn 's/^Package: (.*)$/\1/p' ${list%_*Release}*Packages | sort -u \
    | xargs 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.

1

From the command line If you like to do means

awk '$1 == "Package:" { if (a[$2]++ == 0) print $2; }' /var/lib/apt/lists/*PPA-FIRST-PART*PPA-SECOND-PART*Packages

for example : All there are packages from noobslab

 jai@frank-Jai:~$ awk '$1 == "Package:" { if (a[$2]++ == 0) print $2; }' /var/lib/apt/lists/*noobslab*Packages

python-logilab-common
synapse
ubuntuone-client
python-ubuntuone-storageprotocol
ubuntuone-client-gnome
python-ubuntuone-client
lives
libweed0
libweed-dev
lives-data
converseen
minitube
libsyncdaemon-1.0-1
libsyncdaemon-1.0-dev
ubuntu-sso-client
python-ubuntuone-devtools
ubuntuone-dev-tools
ubuntuone-control-panel
python-ubuntuone-control-panel
synapse-dbg
gir1.2-syncdaemon-1.0
libweed-dbg
lives-dbg
umplayer
umplayer-translations
libgranite-dev
deepin-software-center
ubuntuone-control-panel-qt
python-dirspec
rhythmbox-ubuntuone
python-ubuntu-sso-client
ubuntu-sso-client-qt
python-ubuntu-sso-client.tests
granite-demo
ubuntuone-client-proxy
python-oauthlib
slidewall
python3-dirspec
python3-oauthlib
ubuntuone-client-data
libgranite1
libgranite1-dbg
gir1.2-granite-1.0
libgranite-common
curlew
fbmessenger
open-as-administrator
indicator-synapse
indicator-synapse-dbg
wallpaper-manager
awoken-icon-theme
malys-uniblack
malys-uniblue
malys-ex
acyl-icons
nitrux-icons
piratunbu-icons
azenis-green-icons
nouvegnome-color
nouvegnome-gray
hi-lights-icons
matrilineare
zoncolor-icons
royal-linux-icons
elementary-icons
myhumanity
myelementary
glass-icons
osx-nostalgie
sky-blue-cinnamon
sky-blue-gnome
sky-blue-unity
wine-blue-remix
lubuntubox
windows7-icons
appleart-icons
magical-lights-icons
colored-plastic-icons
numix-utouch-icon-theme
ubudao-style
artnet-icons
high-delight-icons
snow-sabre-icons
trevilla-icons
aery-icons
ambiance-blue
zukitwo
gnomishbeige-theme
salience-theme
zukiwi
gnomishgray
delorean-dark
smoothly-theme
ambiance-ds-blue
ambiance-lime
gnomishdark
zukitwo-cupertino-gs
mediterranean-theme
elementaryish
borderline
boje
wow-2
zoncolor-themes
omg-suite
simplex
leopard-steel
dorian-theme
daylight
adwaita-elements
uncomplicated
trevilla-jmhzonedark
trevilla-dark
trevilla-white
trevilla-whiteblue
trevilla-whiteorange
trevilla-white2
ambiancep-set
ambiance-crunchy
trevilla-gray
siva-series-gtk
cobibird
elegant-brit
mac-ithemes-noobslab
mac-icons-noobslab
ubuntu-touch-themes
windows8-theme
bigfootblue-cinnamon
windows8-cinnamon
eliza1-cinnamon
bigfootred-cinnamon
plus1-theme
futura
blo-theme
darkair-theme
plane-gtk3
deepin-gtk-theme
nokto-theme
numix-theme
neptune-theme
trevilla-themes
jai@frank-Jai:~$ 

Credit goes here

  • I got this error: bash: awk: No such file or directory – Enkouyami Sep 7 '13 at 16:55
  • @Enkouyami whats the ls of /var/lib/apt/lists/ – rɑːdʒɑ Sep 8 '13 at 4:11
  • Here's a link to what I got pastebin.com/AmiH9E9n – Enkouyami Sep 9 '13 at 7:12
  • @Enkouyami oops sorry , I mean the command what you have entered – rɑːdʒɑ Sep 9 '13 at 7:16
  • 1
    @Enkouyami Ok this in not about command , placement. do as awk '$1 == "Package:" { if (a[$2]++ == 0) print $2; }' /var/lib/apt/lists/*haguichi*webupd8team*Packages – rɑːdʒɑ Sep 10 '13 at 1:54
1

Then you can use Y-PPA manager. Open your terminal and type:

sudo add-apt-repository ppa:webupd8team/y-ppa-manager
sudo apt-get update
sudo apt-get install y-ppa-manager

Then open your Unity dash and search with Y -PPA and then open the Icon.

enter image description here

Click at manage PPAs as shown in the image and then select one PPA and it will give you the details of the PPA and Its packages.

  • Could you provide some instructions for using Y-PPA manager? – Seth Sep 7 '13 at 4:26
  • @Seth my friend. done. – rɑːdʒɑ Sep 7 '13 at 4:40
  • I was looking for a command line solution. – Enkouyami Sep 7 '13 at 16:52
  • This solution is neither command line nor answers the main question - how to list packages installed from a given repo? It only shows ALL packages available from a PPA. – Viacheslav Rodionov Feb 7 at 8:54
1

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.

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.