I have run the following command accidentally
sudo chmod 777 -R /
What should I do to get back to previous state?
In this case, there is only one answer:
Reinstall your system. You have changed your system irreparable. There is no way to restore the permissions reliable.
Indeed this would be hard to recover, you can chmod and chown using a Live CD.
Boot from live CD and then change permissions as you want, but this would take you much time to did and much effort, since you have to know first what permissions each directory have to apply on, and it may have many permissions in the same directory so you may have to change permissions for each file independently and this would be a disaster, so the easy work:
Using your Live Cd take a backup of your data then make a fresh install. this would be easier than dealing with permissions.
Wow! Try this:
Check this out first: http://www.slideshare.net/cog/chmod-x-chmod
or create a new chmod and use that for the original chown +x 000 cat chmod > ~/my-chmod ~/my-chmod a+x chmod
This is just a try before quitting suggestion, however I tend to agree with the consensus of wiping out and starting over.
please post your results