After every new OS install, you usually will need to download all the necessary packages that were in the previous installation to maintain the continuity of your old system build. This is definitely time consuming and also trying to remember all of the packages used on the previous system can be difficult, to say the least. But by using dpkg we can do it in a few commands.
Before doing a fresh install, run this command to save a list of all package selections. This is a list of the packages that you had in your previous system.
sudo dpkg --get-selections > packages.list
Now, in the freshly installed system run this command to replicate all the packages that you had in your previous installation.
sudo dpkg --set-selections < packages.list && sudo apt-get dselect-upgrade