How to Clone a Debian Install
September 4th, 2007 by Andrew WellsAlthough it is insanely easy to install software on Debian systems using the package manager, there is a neat technique that you can use to clone a PC or reinstall all your software with one command after a format. This works with all Debian-based systems.
First, run this command:
dpkg --get-selections
You will see that the above command outputs all the packages that you have installed on your machine. Let’s put that in a text file and save it for later.
dpkg --get-selections > ~/packages.txt
Now we have that same output you just saw sent to a text file in your home folder. Save that file if you are going to wipe your system, or copy it to the computer you want to clone.
Now, to restore it, just make sure that you have that packages.txt file in your home directory, and run this command:
sudo dpkg --set-selections < ~/packages.txt && sudo apt-get dselect-upgrade
Wait for that last command to finish, and you should be set.