Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
Belongs on unix.stackexchange.com –  kojiro Apr 3 '13 at 16:24
1  
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
add comment

migrated from stackoverflow.com Apr 3 '13 at 16:34

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

3 Answers

up vote 1 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 Apr 3 '13 at 17:37
add comment

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
add comment

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 Apr 3 '13 at 17:39
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.