Tag Archives: debian

List of installed packages on Ubuntu

This lists packages added after Ubuntu was installed.

When I upgrade from one version of Ubuntu to another, I do a fresh install. I have a procedure on my personal wiki with all of the steps to move in. Part of that is restoring data from backup, Part is restoring or recreating configuration files.

But what about software packages? There is a baseline of packages that I use all the time, but I also add packages ad hoc as required. It is convenient to get a list of what is installed.

Here’s a one-liner to list installed packages on Ubuntu:

cat /var/log/installer/initial-status.gz | gzip -d | grep '^Package:' | awk '{ print $2}' > tmp.txt && aptitude search -F %p '~i!~M' | awk '{ print $1}' | grep -v -F -f tmp.txt && rm tmp.txt

The list that is returned is pretty good. You can save the output to a text file and edit that file to get the list of packages you want to install on the new system.

Here’s how to output to packages.txt:

cat /var/log/installer/initial-status.gz | gzip -d | grep '^Package:' | awk '{ print $2}' > tmp.txt && aptitude search -F %p '~i!~M' | awk '{ print $1}' | grep -v -F -f tmp.txt > packages.txt && rm tmp.txt

As you can see, it greps out a list of packages included in the original install, grabs the second field with awk and stuffs the result in a temporary file. Then a list of installed packages is generated, again using awk to parse out the package name field. Then grep is used to compare thee two lists and output just the packages installed after initial installation.

Here is what I have installed:

apache2
apache2-utils
apache2.2-common
audacity
bluefish
build-essential
figlet
flashplugin-installer
gimp
gnome-do
google-chrome-beta
inkscape
keepassx
libapache2-mod-php5
mailutils
mysql-server
ninvaders
nvidia-current
padre
php5
php5-cli
php5-common
php5-curl
php5-dev
php5-gd
php5-imagick
php5-mcrypt
php5-memcache
php5-mysql
php5-pspell
php5-snmp
php5-sqlite
php5-xmlrpc
php5-xsl
phpmyadmin
skype
vim
vlc
winff
xtightvncviewer

So, this is a list of 40 packages installed on my machine, out of a total of 1560 packages returned by “dpkg –list” (thanks, Mark!). Just those I installed, not everything including all of baseline Ubuntu.