What is this?
minpkg.py is a simple script which gives you a list of the packages you installed in your Debian/Ubuntu system. More precisely, it gives you a list of packages that were explicitely installed (not installed automatically as dependencies).
It does so by:
- extracting the list of all installed packages (thanks to python-apt)
- removing from this list packages which were installed automatically (by looking at file /var/lib/apt/extended_states )
- printing the result
What can I do with it?
Assume you must move to a new system, or you just messed up your installation and want to restart from scratch, with all the packages you currently have.
You may get the full list of installed packages with “dpkg –get-selections | grep -v deinstall” and reinstall those on the new system, but assume you installed package a depending on package b, and assume that later on, a new version of a on your new system replaces dependence on b with a dependence on new package c: then by upgrading you will indeed install c, but b, though unused, won't be removed by command “apt-get autoremove”.
Moreover, if the new system runs a newer release, package b may have been already replaced, so your restore would fail because it wouldn't find it.
Using minpkg is as simple as:
(on the old system)
./minpkg.py > installs_list
(on the new system)
sudo apt-get install `cat installs_list`