How to Get a List of All Root / Main Installed Packages on Debian

6,621

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.)

Share:
6,621

Related videos on Youtube

Elmar Weber
Author by

Elmar Weber

Updated on September 17, 2022

Comments

  • Elmar Weber
    Elmar Weber over 1 year

    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.

  • Elmar Weber
    Elmar Weber almost 14 years
    This also shows other packages, e.g. over 70 libraries.
  • user1717202
    user1717202 almost 14 years
    Yeah, those were most likely installed during system setup. I added a paragraph explaining this.