Compare Installed Packages

When building a new system or reinstalling a system on another system it can be very useful to check to see what differences there are between the packages installed on each system.

The following command will list all the installed packages.

$ dpkg --get-selections
acpi-support-base                               install
acpid                                           install
adduser                                         install

Assuming that we have a file called ‘packages.txt’ that contains a list of all the packages that were installed on you system in the past (or that are installed on a different machine) you can use this file to see what the differences are between the two configurations.

To see which packages are missing from your current configuration use:

$ dpkg --get-selections | sort | comm -1 -3 - <(sort packages.txt)
b43-fwcutter                                    install

To see which packages have been added since you recorded which packages were installed use:

$ dpkg --get-selections | sort | comm -2 -3 - <(sort packages.txt)
gcc-4.3-doc                                     install
gcc-4.3                                         install
gcc-doc-base                                    install
gcc                                             install
gdb                                             install

In this case you can see that I’ve recently installed the additional packages required for gcc.

This entry was posted in Linux and tagged . Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s