dump dpkg package list for fresh installation [duplicate]

Possible Duplicate:
Best way to backup all settings, list of installed packages, tweaks, etc?

I've heard that I can dump the dpkg package list of currently installed applications, then after I re-install, re-import that list and have apt or dpkg do all the heavy lifting for me getting my apps re-installed.

How do i do this?


To dump the list of currently installed applications:

dpkg --get-selections >output-file  

To re-import:

sudo dpkg --set-selections <output-file 
sudo apt-get dselect-upgrade