1

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?

bruchowski
  • 5,043
  • 7
  • 30
  • 46
  • Out of curiosity, did you find it in the list? – skyler Aug 19 '15 at 02:53
  • sure did! thanks :) broke down the command too, didn't know about `--get-selections` on `dpkg` and `depends` for `apt-cache`, thanks for the lesson – bruchowski Aug 19 '15 at 02:56
  • Glad to hear it worked! That was a fun one because this is the first time I have ever done anything more complex than `'{print $1}'` with awk. – skyler Aug 19 '15 at 03:01

1 Answers1

0

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

skyler
  • 1,487
  • 1
  • 10
  • 23
  • This is a bit long for me to go through and explain each piece especially when man pages are always handy, but if you have any particular questions about how this works, just comment and I will edit my answer with some explanation. – skyler Aug 19 '15 at 02:46