How to tell which repositories provide which packages?

Little Girl littlergirl at gmail.com
Tue Jan 5 22:47:47 UTC 2021


Hey there,

Ralf Mardorf via ubuntu-users wrote:

>It's not that easy.
>
>For example
>
>  apt-cache policy '*' | grep ppa
>
>shows all packages provided by a ppa and to what ppa they belong to,

That seems to list only packages that contain "ppa" in their names
rather than packages provided by a PPA.

>so '*' must be replaced by the output of a script, that lists only
>all installed packages, something like e.g.
>
>  apt list --installed | cut -d/ -f1
>
>However, something like
>
>  apt-cache policy $(apt list --installed | cut -d/ -f1) | grep ppa
>
>won't do the job, since it does list packages containing 'ppa' that
>don't belong to any PPAs, while PPAs are shown without the installed
>packages that belongs to them.

Yep, those don't work for me, either.

>It's possible to solve this issue, either by investing some time in
>writing a script or perhaps by googling for scripts that already do
>exist.
>
>AFAIK there's no command available, that does what the OP wants to
>get.

I had sent a couple of possibilities for him in a previous email, but
have been tinkering with it since then so I can add it to my
ever-growing cheat sheet of common commands. This one shows all
packages installed by any PPA on the system rather than listing
packages from a specific PPA:

awk '$1 == "Package:" { print $2 }' /var/lib/apt/lists/repo.*Packages

I suppose that could come in handy at some point.

-- 
Little Girl

There is no spoon.




More information about the ubuntu-users mailing list