Not able to save file using vim

Im not able to save my vim file.
what do I do

After making changes in insert mode (you can enter insert mode by pressing i), press the esc key to get to the command mode, then :x to save the file.

@anshima03 you could also use esc followed by “:wp

Use sudo vim even I have faced this problem otherwise use sudo su first and then open the file using vim

Otherwise if you have already changed the file and don’t want to loose the file content then type :w! sudo tee % and then press O for making changes