5

With aptitude:

I can see the number of reverse dependencies with %r in the display format string (preferences), but how can I group/limit the package list according to that count?

I want to see/filter/search all packages which nobody depends on.

1 Answers1

11

%r gives you the number of installed packages that depend on that package.

You can list the installed packages for which no installed package depends on with:

aptitude search '~i ! ~R ~i'

You can extend that to recommends and suggests with

aptitude search '~i ! ~R ~i ! ~Rrecommends:~i  ! ~Rsuggests:~i'

You can list packages that no package (installed or not) depend on with:

aptitude search '! ~R .'

If your point is to list packages that you can safely remove, then, as pointed out by Braiam, you may want to also exclude essential packages (~E) and those with required priority (and possibly important).

In aptitude (preferably in flat-list view), press (lowercase L) and enter:

~i ! ~R ~i ! ~Rrecommends:~i  ! ~Rsuggests:~i ! ~E ! ~prequired ! ~pimportant

(once you remove packages, some more packages may pop up in that list once the packages that depended on them have been removed)

See also ~g (?garbage), for the packages which are not installed, or which were automatically installed and are not depended upon by any installed package.

  • I would exclude essential and critical packages ;) – Braiam Mar 14 '14 at 22:45
  • In my case, I was looking for transitional packages with no reverse dependencies. I group them with key G: pattern(?any-version(~i ?or(~dtransitional,~ddummy) !~R~i) => trans. pkgs not depended on) – To look in the description is not safe, but I think there is no better way. – Robert Siemer Mar 15 '14 at 14:48
  • @Robert, your transitional packages with come under ~g if they are marked as automatically installed. Eventually they will come under ~o, which selects obsolete packages, when they are removed from the repository. I don't think there is any reliable way to filter for them specifically though. – Graeme Mar 15 '14 at 19:26
  • @Graeme, they where not all automatically installed (otherwise they would be gone). – And before they get obsolete might take years... – Robert Siemer Mar 17 '14 at 06:21