Can anyone tell me how I can undo a
sudo rm -r /var/run mistake?
I am unable to use sftp and mysql now.
that will fix most things, anything that still doesn't work will just need to be restarted
edit: restarted as in,
It depends. On certain file-system types, it is possible to do an undelete and recover earlier data such as for reiserfs but it may not work for other file-systems. However, your mileage may vary.
If it is a matter of getting some applications to work, you may succeed by re-installing some of them and re-starting others.