Which packages did I add?

From MEPIS Documentation Wiki

Jump to: navigation, search

Introduction

Sometimes you might want to know which packages you added manually using one of these methods. For example, you may plan to install new version of your operating system and this version is so different that you decide to keep just your /home partition and reinstall everything else from scratch. However, you remember that while using your old system, you added quite a few packages which provide you some important functionality. You would like to install them on your new system as well. For some of them, guessing the name is easy - once you notice that you favorite program is missing, you just search for it in Synaptic and install it. But some are tricky - for example you might have installed some superb fonts on your old system and now you are quite desperate trying to get them again on the new one.

Basic Methods

There is no perfect solution, but the following approaches might help a bit.

  • List all packages installed on your system:
dpkg -l >LIST
less LIST

but this list is very long and it does not tell you which packages were in the basic install, which came later via security updates, which you added by hand and which were added automatically to satisfy dependencies. Keeping this type of list may help, but it is really useful only when you are re-creating nearly identical system, as described in Back up your data. It is still a good idea to save this list every time you install a new system and every time you are leaving an old one. If you have these lists for two states of the same system, you can compare them in one of these ways:

  • Use a GUI application such as Kompare (available through Synaptic)
  • Type on the command line:
diff OLDLIST NEWLIST
  • Install the command-line application docdiff for a nice color comparison and type:
docdiff --tty --digest OLDLIST NEWLIST

If you did not make such a list when your old MEPIS system was new, you can still boot the old Live CD and make the list (just remember to save it to some permanent location, not just to ramdisk).

Advanced methods

When there are many differences in these lists, it might be better to recover chronological list of changes made to your old system:

ls -lt /var/lib/dpkg/info/*.list|less

Looking at dates, you can even guess what package you entered by hand and what are the dependencies. A little postprocessing can make it nearly perfect:

ls -lt /var/lib/dpkg/info/*.list|awk '$6!=x{print "";x=$6;print x}{printf " %s", substr($8,20,length($8)-24)}'|less

For example, on my old Debian Sarge, this reveals:

2007-05-28
 wavesurfer
2007-04-26
 cftp
2007-04-16
 nvu
2007-02-09
 subversion db4.2-util libsvn0
2007-02-07
 firefox mozilla-firefox
2006-12-28
 scli
2006-12-15
 rcalc libzvt2.0-0
2006-10-18
 tkgate
2006-07-23
 docdiff libruby1.8 ruby1.8
2006-07-09
 automake1.9 automake1.4 autoconf autotools-dev
...

and now I can remember for instance when docdiff was installed along with its dependencies. A small script could even be written for package dependency analysis.

And of course - if you are scared by the all the command line magic above - making notes whenever you install new packages works as well!

Personal tools
In other languages