Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I accidentally deleted python, python2, python2.7 files from /usr/bin/. Now yum is also not working.

Is it possible to recover them?

share|improve this question

migrated from Apr 3 '13 at 16:34

This question came from our site for professional and enthusiast programmers.

Belongs on – kojiro Apr 3 '13 at 16:24
Wouldn't it be easier to just reinstall the lot? – Emilio M Bumachar Apr 3 '13 at 16:27
@emilio m bumachar- neither yum nor rpm working. Tried compiling from source, but I guess there is some problem with the path configuration. M confused. – Sanchit Apr 3 '13 at 16:32
up vote 2 down vote accepted

You cannot recover the files, if you really deleted them. If you have no backup at hand, and you don't want to reboot from the installation disc, you can still try to copy it over from a different installation of the same OS:

cp /path/to/your/copy/python2.7 /usr/bin
ln -s /usr/bin/python2.7 /usr/bin/python

It should be the same OS and distribution for the same processor family and type.

If that fails, you can still boot from the installation disc and re-install Python.

share|improve this answer
Thanks! I installed a VM with same OS and copied the missed files(including /usr/lib/python2.7 directory). Now it is working fine. – Sanchit R. Apr 3 '13 at 17:37

Generally on UNIX-like systems, deleting a file means it cannot be retrieved. (Unless you are using a filesystem that has the ability to take snapshots, and you are using them.)

Restore the files from your most recent backup.

share|improve this answer

If yum and rpm aren't working you can always download the rpm packages for python and/or python2.7for your arch (from your distro repositories), extract their contents, inside you should find the executable(s) you have deleted from your system. Just copy them in /usr/bin, chmod 755 and you're done.

share|improve this answer
ok.. This too is a good solution. But anyways I installed a VM with same OS and copied the missed files(including /usr/lib/python2.7 directory). Now it is working fine. Thanks anyways.. – Sanchit R. Apr 3 '13 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .