Ubuntu – Write List of Packages installed via Manual Invocation of apt-get to File


I'm trying to install a new version of Ubuntu from scratch, but I would like a list of the packages which I manually installed (as opposed to installed as a dependency or that came with the system).

I can get a reasonable approximation on Synaptic by looking at only my Installed (manual) packages and then only looking at those packages not supported by Ubuntu (i.e. all those files without the Ubuntu Unity symbol next to them). However, I cannot seem to get Synaptic to export a list of these packages.

Hence my question is whether it is possible to generate a list of packages that were installed manually via the apt-get install command?

The following do not work:

This question is similar in flavor to other questions that have been asked both on Stack Exchange sites and elsewhere (such as Generating list of manually installed packages and querying individual packages, https://serverfault.com/questions/133681/generating-a-list-of-installed-packages-in-ubuntu, and http://ubuntuforums.org/showthread.php?t=947865&page=2).

David Kalnischkies on http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=727799 gives some perspective as to why pinning down exactly what "manually installed" means is difficult (e.g. do programs which you ran which installed packages count as "manually installed"?). Therefore I have specifically limited this question (unlike the others that I listed) to only invocations of apt-get install.

Edit: How to view a list of packages that were manually installed without their dependancies has a nice idea for using the log files of apt-get to do this. Unfortunately this doesn't keep track of which packages have been removed. And even if I were to simply grep 'apt-get purge' and take the diff of the two lists that I get it still wouldn't account for the edge case that I've installed a package, uninstalled it, and then reinstalled it.

Best Answer

Since no answer using apt has been found, I would suggest going into Synaptic Package Manager, click on the Status button at lower left then click on Installed (manual) at upper left to see a list of installed packages.

List from Synaptic of installed packages

Then you can output a list from Synaptic with File | Save Markings As and save the file where you can work with it.