Re: finding apt dependencies

jean-christophe <[email protected]> Tue, 07 Jul 2026 21:14:19 +0200
Newsgroups gmane.linux.debian.user
Message-ID <54166b187773b3359fcf46154a217e9f7dc0d0d1.camel@blues-softwares.net>

On mar., 2026-07-07 at 14:18 -0400, Eben King wrote:
> I have a need to find the upgradable package with the most
> dependencies. 
>   So far I've got this, in /bin/sh:
> 
> allpkgs="$(apt list --upgradable 2> /dev/null | grep / | cut -f 1 -d
> / )"
> max=0
> countlist=""
> for package in $allpkgs ; do
>    dependencies=$(apt-get --simulate upgrade "$package" | grep
> upgraded, 
> > cut -f 1 -d ' ') # get #dependencies, maybe; this is the slow bit
>    [ "$dependencies" -gt "$max" ] && max="$dependencies"
>    countlist="$countlist $dependencies $pkgname"
> done
> 
> It works, but is definitely not fast. Is there a faster way?

may be try awk

apt-get is a big cmd and is great

remember -gt ?

may be use apt-cache --full

regards
jean-chistophe