Ubuntu – I accidentally deleted /usr/bin/python. How to restore it


Trying to set the default Python version to 2.7, I ran this command:

sudo rm /usr/bin/python*

Now when I type python or python2.7, I see these error messages:

bash: /usr/bin/python: No such file or directory
bash: /usr/bin/python2.7: No such file or directory

What happened? Should I have run the rm command? How can I undo it?

Best Answer

Well, isn't normal that if you remove an executable, the system can't find it anymore?

/usr/bin/python is a symlink provided by the python-minimal package. You can restore it reinstalling the package:

sudo apt-get install --reinstall python-minimal