Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to wipe my hard drive and reinstall Ubuntu. /home is on a separate partition, so I can back that up to a backup drive, then copy it back to the wiped drive, install ubuntu, and point it at the existing /home, no problem.

However, I also want to script a reinstall of all my apt repo's and the packages I currently have installed, so I don't have to waste hours doing that manually. Anyone know a good way to do this?

PS - At least, I'm pretty sure I have to wipe the drive. Need to install Windows 7, and only have an HP system restore disk that formats the whole drive, and not a legit Windows 7 install disk that lets me install on a single partition. If somebody know a way to trick the system restore disk to install only to a single partition, I'd love to hear it.

share|improve this question
up vote 1 down vote accepted

Use this to save a list of your currently installed packages

dpkg --get-selections > my_apps.txt

After you've reinstalled, this selects all of your packages

dpkg --set-selections < my_apps.txt
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.