Computers Linux

Keeping track of installed apps under Debian

I am setting up my new server with Ubuntu 8.10. This time, I am planning to keep track on all the software I install on it so that I might restore it in the future. Thankfully, with the Debian package manager this is a simple task.

The following command creates a text file with all the installed applications on the system:

dpkg-query -W -f='${Package\n}' > installed-apps

The file will put one one package name on a line and end it with a line break, saving the output to the file installed-apps. By changing the \n at the end into a space it is possible to get a single long string with all the package names.

After a while you may want to know which packages have been installed since the initial operating system installation. There are no doubt many ways of doing this but the easiest I have come up with is to run the same command as above, but save the output to another file, and then to run ‘diff’ on those two files. Note that this requires that the output from the dpkg-query command above was using line breaks to separate packages.