Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 11 down vote accepted

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 where not automatically installed:

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

Alternatively, using short form for 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 where 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 afterwards.

(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 where installed, say, a year ago.)

share|improve this answer
This also shows other packages, e.g. over 70 libraries. – Elmar Weber Jul 17 '10 at 15:00
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 posting your answer, you agree to the privacy policy and terms of service.

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