Single Command to Reinstall Ubuntu

Did you screw up your Ubuntu install? No need to download all the packages or get our your Ubuntu CD for a new installation. A single command can help you reinstall Ubuntu and reinstall all the packages from core and reconfigure them.

To reinstall or restore Ubuntu to a factory install from the command line, run the following command:

Source: askubuntu.com
   1: sudo dpkg-reconfigure -phigh -a

To run minor restores and dependency issues, you can run the command:

   1: sudo apt-get install -f

Don’t forget to backup your data before you run any of the commands.