Score:3

List dependencies of package that I don't already have installed?

in flag

I want to know ahead of time how many extra packages need to be installed for a given package. I know I get something like this when I do an apt install -s package | grep ^Inst, but can I get the same info using the apt-cache command without needing to grep the output of the simulated apt install command?

I know I can show a list of dependencies for a package with the command:

apt-cache depends package-name

and I know I can limit that list to only those dependencies that I have already installed on my system with:

apt-cache depends -installed package-name

but how can I list only the dependencies that I don't yet have installed on my system? Something akin to:

apt-cache depends -uninstalled package-name
hr flag
The tricky thing here is that if a (direct) dependency *is* installed, then you know all of its sub-dependencies must also be installed. However if a (direct) dependency *isn't* installed, you don't know which other sub-dependencies may be required without recursively traversing all the way down.
Score:2
jp flag

In layman's terms :)

You can find dependencies, recommends and suggests for a package like so:

apt-cache depends package-name

You can limit it to dependencies only like so:

apt-cache depends package-name | awk '/Depends:/ {print $2}'

You can check installation status of these dependencies like so:

apt-cache depends package-name | awk '/Depends:/ {print $2}' | xargs apt list

You can print only uninstalled dependencies for a package like so:

apt-cache depends package-name | awk '/Depends:/ {print $2}' | xargs apt list | awk '!/installed/ {print}'
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.