You know you are brutally Screwed when you use the command:
sudo chmod 777 -R
without specifying the path of file/folder. In Linux, GUI and CLI works something differently when it comes to handling the path. From GUI you can start the Terminal in any folder which might show the full folder location like ‘/home/rajib/myfiles $’ and if you want to give ALL Privilege to the everyone in the system, you might fancy doing: sudo chmod 777 -R, thinking that you are already in the folder and it’ll make everything right for you, but all the opposite happens and you are screwed. You have hit -R which stands for ‘Recursive’ and all the system root folders/files gets 777, so, you’re bound to put your hand in the head. If you want to try such thing then better use it without -R, it’d still screw some of your system files, but prompts you for other actions too, as its not in recursive mode and damage might be recovered with some effort.
The best way to deal with it is to give full path everytime you use this dangerous command. i.e. something like sudo chmod 777 -R /home/rajib/myfiles/ or sudo chmod 777 -R /home/rajib/myfiles/*
If you have already used the command and you system is already screwed, then nothing much can be done, Just backup your home folder or important files and restore the system / reinstall the software once again.