Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

An android project has its /bin directory and what I wanted to do is to deleted this. What I actually mean is delete /path/to/android-project/bin not the /bin directory.

So I executed this command,

path/to/android-project$ sudo rm -rf /bin

Now, the entire /bin directory is deleted. I wanted to try restoring it in by using terminal but I cant launch the terminal since there are files in /bin related to terminal that have been deleted (my guess).

Are there any ways to restore /bin directory? I'm looking into upgrading ubuntu.

share|improve this question
add comment

2 Answers 2

up vote 5 down vote accepted

/bin contains some of the most basic files on your system, and it won't be able to do much without it (booting will not work, same for installing packages). Your best bet is to boot a live cd of the same Ubuntu version as what you are using, mount your exisitng root partition and rsync its /bin over to that partition.

For a full cleanup afterwards, reinstall the affected packages. To find which packages to reinstall, use this command:

find /bin -type f | xargs dpkg -S | sed -e 's/:.*//' | sort -u

And to actually reinstall them:

sudo apt-get install --reinstall $(find /bin -type f | xargs dpkg -S | sed -e 's/:.*//' | sort -u)
share|improve this answer
add comment

In general, every file or folder can be restored, only if you have backup of that practicular file or folder, be carefull when working in terminal, some processes are not recoverable!!! When you write / at first place, no matter where ever you are now, its gonna search for root!!! ./ stands for the current directory, and ../ for the parent (one level up) directory. I am not gonna suggest you to use any bin directory copy beacause i am not sure it could help, but I can tell you to install ubuntu on a new partition, backup your files in that way, if you are not familiar with terminal.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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