Many a time I have re-installed my system from scratch or created a new system, but get sick of continually installing the same packages over and over. Its annoying when 2 or 3 months down the line you want to use a program you used to have (or have on another system) only to find its not yet installed. Sure, an apt-get install only takes a few minutes for a single piece of software, but that’s a few minutes a geek like me could better spend doing something productive.
Thankfully Debian Linux (and thus by extension, Ubuntu and any other Debian variant) have made life easy in these situations. You can easily list every installed application on your system
# sudo dpkg --get-selections
That will show you everything apt-get has installed for you at this moment in time. But it doesnt stop there, we can use some cool tricks to allow us to backup our system software for an easy re-install later, or perhaps so we can mirror our installed software to other systems.
# sudo dpkg --get-selections | grep -vi kernel > /etc/installed.conf
This piped command creates a file in /etc called ‘installed.conf’ which contains all software installed on your system currently, excluding kernel related packages. The reason we exclude kernel related packages is that if you use this list to mirror your installed applications on another system, we dont want your kernel, kernel modules or other kernel specific items being overwritten or messed around on the other system.
Now lets say you are on a fresh install of Debian, Ubunutu etc and have a installed.conf you want to use to restore (or do a fresh install) of your software. Stick installed.conf into /etc and then its pretty damn easy:
# sudo dpkg --set-selections < /etc/installed.conf # sudo dselect
Select the 'i' option in dselect to install your packages and the system will do the rest for you
Hope you found this post useful!