How to find/list packages by number of dependencies using apt?

288 views Asked by At

I installed a command line video game emulator on a media server running Ubuntu 14.04.2 LTS a long time ago and I can't remember what it was called.. I only remember that it had a ton of dependencies.. I'm trying to clean up that server now and I'm wondering if there's any way to somehow list packages by number of dependencies? Where is that information stored in apt/aptitude/ubuntu? Is there a better way to go about this?

1

There are 1 answers

1
CleverLikeAnOx On BEST ANSWER

dpkg --get-selections | grep -v deinstall | awk '{print $1}' | xargs apt-cache depends | awk '/^ / {count++} /^[^ ]/ {print count " " $1; count = 0}' | sort -V