How to tell which repositories provide which packages?

Ralf Mardorf kde.lists at yahoo.com
Wed Jan 6 15:50:43 UTC 2021


On Wed, 6 Jan 2021 10:26:22 -0500, Little Girl wrote:
>apt-cache showpkg "*" | grep repo | grep File | awk -F " " '{print
>$2}' | awk -F "." '{print $2}' | sort -u

This one doesn't work for me.

[weremouse at moonstudio ~]$ apt-cache showpkg bash | grep repo | grep File
[weremouse at moonstudio ~]$ apt-cache showpkg vim | grep repo | grep File
[weremouse at moonstudio ~]$ apt-cache showpkg bash | tail -1
bash:i386 4.3-14ubuntu1 (= 4.3-14ubuntu1)
[weremouse at moonstudio ~]$ apt-cache showpkg vim | tail -1
vim-gnome 2:7.4.1689-3ubuntu1 (= )
[weremouse at moonstudio ~]$ lsb_release -d; dpkg -l apt | grep apt
Description:	Ubuntu 16.04.7 LTS
ii  apt            1.2.32ubuntu0.2 amd64        commandline package manager

>Get the names of all packages installed by your PPA (replace XXXX in
>this command with your source name):
>
>dpkg -l $(awk '$1 == "Package:" { print
>$2 }' /var/lib/apt/lists/repo.XXXX*Packages) 2>/dev/null | grep ii |
>awk '{print $2}'

As already pointed out, the "grep ii" could lead to false positives.

>Or get the names and versions of all packages installed by XXXX
>(replace XXXX in this command with your source name):
>
>apt-cache policy $(awk '$1 == "Package:" { print
>$2 }' /var/lib/apt/lists/repo.XXXX*Packages) | grep -v
>"Installed: (none)" | grep "Installed: " -B1

I still would use this one and hope that we didn't miss a mistake. My
impression is, that it works without a pitfall, but I might be mistaken.




More information about the ubuntu-users mailing list