It is usefull to create a list of packages, to reinstall all of them easily, on a fresh new Linux box. I find it easier to save the package names in a file, separated one from another by space and to do this, on the freshly installed new Linux: cat package_list | xargs sudo apt-get -y install.
$ echo "package_1 package_2 package_3 package_99" > ~/.bak/package_list
$ cat package_list | xargs sudo apt-get -y install #this should be done on the new OS
cat opens the package_list file, and passes the content to apt-get as parameters. -y is for answering yes, to the installation process.