Keep a Backup of Installed Packages

You might prefer to have a clean system on reinstall but sometimes it is nice to reinstall applications from a previous machine/setup. Keeping a backup list of packages will make this a snap. Just give your package manager a list of all the packages you want it to install and let it rip.

Here are the backup and restore methods for each of the major distros/package managers.

Debian / Ubuntu

Backup

dpkg --get-selections > installed-software.log

Restore

dpkg --set-selections < installed-software.log
apt-get dselect-upgrade

Arch Linux

Backup

pacman -Qqe | grep -v "$(pacman -Qmq)" > pkglist

Restore

pacman -S $(cat pkglist)

Fedora

Backup

rpm -qa > installed-software.bak

Restore

yum -y install $(cat installed-software.bak)

Gentoo

Backup

cp /var/lib/portage/world installed-software.bak

Restore

cat installed-software.bak | xargs -n1 emerge -uv

OpenSuse

Backup

rpm -qa –queryformat ‘%{NAME} ‘ > installed-software.bak

Restore

sudo zypper install $(cat installed-software.bak)