Dangerous? Not any more – you already did the dangerous thing.
You just deleted the part of the system that has essential things that belong every system needs. According to wikipedia’s article on the FHS /bin contains “Essential command binaries that need to be available in single user mode; for all users, e.g., cat, ls, cp.” These are MASSIVELY important in some contexts.
Assuming you want to fix this, you might be able to copy over /bin from a running system – maybe off a livecd of the same version of your distro. I’m not totally sure this would work.
Nonetheless, while you’re trying this, back up any essential files in case anything goes wrong. /etc/ /home and /var might be good ideas, as would /srv in distros that use it
Yes, what you just did is quite an essential mistake, maybe comparable to deleting Program Files on Windows (if that’s possible).
If you have another (virtual) machine around, you could try this quite decent and fast solution to this common problem:
What do we need?
- ssh, rsync, sudo should all still be available
- you should have a similar system reachable from your network (with
- Copy the bin directory:
The ‘#’ sign means, you should be root. Substituting ‘#’ with “sudo” will do on most systems. On others, use “su”.
# rsync -rv <remote-login>@<remote-server>:/bin /
# scp -rv <remote-login>@<remote-server>:/bin /
- Then ‘cd’ to the /bin directory (which should work again now)
# ln -s bash sh
This is important since most programs actually link to /bin/sh and many
scripts have it in the shebang (#!) line. You should link to bash (for
most people), or the shell you use (for those, who probably wouldn’t
delete the /bin directory anyway).
- Update and upgrade from your repository (on Ubuntu and Debian)
# aptitude update && sudo aptitude upgrade
# apt-get update && sudo apt-get upgrade
That should at least get you a working system. You should maybe
reinstall coreutils and in general be vary of any problems. You should
backup your data and be cautious.
I have done the following and was able to recover my fully functional Ubuntu within 5 minutes.
Install a Copy of your Ubuntu (Same version which has crashed) into a pen-drive.
Run Ubuntu live mode with pendrive on your sick machine
Locate your crashed drive and mount it from the “places” tab, in the very top-left corner of your machine.
Open terminal using Ctrl+Alt+T” and create a bin folder into the mounted drive using
sudo mkdir /media/bin
Copy all the bin files from your live session to victim device, with
sudo cp /bin/* /media/bin
Restart, it may show some message to update your firmwares (or other messages) just ignore for while and login.