Reinstalling your operating system is never a fun or welcome task, but sometimes it’s unavoidable. Restoring settings and downloaded applications after installing an operating system can take quite a bit of time, so I’ve come up with a shell script to make things a bit easier.
This technique does not take the place of a good external backup. I recommend backing up your important files to a place other than your computer, such as a CD or DVD disc, because with a powerful enough shell script, you could accidentally wipe out hours of work in just a few seconds.
When I installed Ubuntu on my computer, I created a separate partition for the home directory, which is where personal files are typically stored. If you do this, you can reinstall Ubuntu without losing your files, as long as you don’t overwrite the home partition. Since I have the configuration files that reside on my root partition backed up inside my home directory, the files should still be there after I reinstall, so all I have to do is copy them to the correct place.
In addition, I have several programs downloaded from the Internet saved in my home directory as well. After restoring Ubuntu, all I have to do is execute a command to install the programs again. My script can take care of that for me as well.