After having these issues: How do I fix broken installation?

... I've decided to reinstall Ubuntu (11.04). I need to do so from the command line. And, while I am reinstalling to clean up and solve some general, confusing problems, I'd still prefer to keep preferences like Keyboard Shortcuts if possible. Is there some magic wand to reinstall like there was with upgrading from 10.10 to 11.04? If I have to back things up on my own, what's a good way to do so from the command line? Are there any other tips you might give me based on the problem I described in the above thread? Finally, do keep in mind that Ubuntu is one of multiple partitions on my machine.

I suppose the main question here is, what is the easiest way to reinstall from the command line? I obviously have my own particular sub-questions here, but, for the sake of the community, a generalized answer will, at least, earn you an up vote from me. I suppose the ideal answer would have one big line with the simple command at the top, and details for my situation somewhere under that.

  • 1
    You cant reinstall the operating system from the command line, the command line is a key component of the OS, you could clean the OS to nearly the same state as a fresh install but it really isn't the same thing. – Smithamax Jul 18 '11 at 23:30
  • Well, I know that the command line is a part of the OS. But I figured reinstalling couldn't be more complicated than upgrading. Can you give me tips on how to back things up from the command line, then? – Daniel Jul 18 '11 at 23:42
  • For backups see: Comparison of backup tools – dv3500ea Jul 18 '11 at 23:50
  • 1
    Upgrading is simply installing new packages, and bumping the version on old ones. Backing up is fairly simple, make a copy of your home folder, including its hidden folders and you have most of your configs. Other things you may want to back up are config files for system services like ssh or samba if your using anything like that. And finally if you've configured system configs like fstab back them up as reference when you reconfigure them. – Smithamax Jul 18 '11 at 23:56

So, the answer to the main question:

You can't.


You can backup by doing things like

#cd to flash drive
tar -cvvf home.tar /home
tar -cvvf etc.tar /etc
  • There is a command to get the list of installed software, and a corresponding one, to reinstall these programs from the list again. I can't name it from my head, but it should be performed as well. – user unknown Jul 19 '11 at 1:54
  • gee, now that would be handy... Can somebody figure out what he's talking about? – Daniel Jul 19 '11 at 16:42
  • It is handy. dpkg --get-selections > packages.txt will save a list of installed packages. dpkg --set-selection < packages.txt will get them back after rebuild. Then run apt-get -y update and then apt-get dselect-upgrade to update your system. Few links: ubuntuforums.org/showthread.php?t=1518468 AND debian-administration.org/article/282/Backing_Up/… – Richard Holloway Aug 9 '11 at 12:38

IMHO, you cannot doing any re-installation process without removing command line system. But if you want to do preserve your settings, you can back your home folder up. Most Linux configuration files store in the . (dot) folders which is hidden by default.

For your system configuration you may back the /etc directory up. And for backing up your application you can use these command:

sudo dpkg --get-selections > /home/<username>/applicationlist.txt

Copy that text file to your media backup. When you have completed new installation, you can fire up your terminal and do this:

sudo dpkg --set-selections /path/to/applicationlist.txt && sudo apt-get dselect-upgrade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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