I'm new to linux and installed Ubuntu 12.04 today. I accidentally deleted everything in /usr/bin
typing in the command rm -rf *
.
I don't know what is mounting and would like to learn but at this point I think the only way left for me is to re install everything. Please let me know the ways to re install everything now. It would be of great help to me.
Best Answer
Since you just installed today, do the installation again. While you can recover from this, it'll be a lot more work than redoing the installation.
To recover from the deletion of
/usr/bin
, you would need to reinstall all the packages that have files in that directory. You can use this command to list the affected packages:You'll then need to find some way of downloading the packages without relying on any of the deleted programs. Since you've deleted
dpkg
, the low-level package installation utility, you'll need to obtain it from somewhere first. Grab it from some other machine running the same release Ubuntu, or download thedpkg
package on another machine and extract the programs from it. You'll need not just/usr/bin/dpkg
but also all the other programs in that package, includingupdate-alternatives
and all the programs named/usr/bin/dpkg-*
. Again, copying might be tricky with so many programs deleted, so you may need to reboot to a rescue CD/USB to do it.Once you have the
dpkg
suite, download at least thedpkg
andapt
package somehow, perhaps on another machine or in a still-running web browser.Then install
apt
manually with the commandIf you get errors about missing commands, reinstall the corresponding packages first. Then reinstall all the affected packages:
Again, in your situation, just do a complete reinstallation.