6

Is there a way to get all "main" packages that were installed via aptitude in Debian? By "main" I mean the package names that were given to aptitude via the install command. The equivalent of a Gentoo "world" file.

To my knowledge you can only get a list of all installed packages, included dependencies (about which I don't really care from a certain point of view). The only other way I could think of is to parse the bash_history file for aptitude install commands.

12

aptitude considers packages that are installed due to dependencies to be "automatically" installed. With that knowledge, you can quickly construct an aptitude search pattern to list all installed packages that were not automatically installed:

aptitude search "?and(?installed, ?not(?automatic))"

Or, using the short form of the search terms:

aptitude search '~i !~M'

(Note that ! is a special character in some shells. In the above, I used '...' as quote chars to make Bash happy.)

Finally, packages which were installed by basic system installation will also be listed in the above. If that's a problem, you can exclude packages which the system considers to be essential by adding an !~E filter. Or you could create a list of packages right after what you consider to be the basic installation, and diff against that.

(grepping through bash history is certainly also a quick and simple option, and will work well if you are mainly interested in uninstalling some recently-installed packages. However, due to the limited size of the bash history, you will have a tough time finding packages that were installed, say, a year ago.)

  • This also shows other packages, e.g. over 70 libraries. – Elmar Weber Jul 17 '10 at 15:00
  • 2
    Yeah, those were most likely installed during system setup. I added a paragraph explaining this. – earl Jul 17 '10 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.