The problem encountered when vi creates a new file and saves the file: E212: Can't open file for writing

Use vi to create a new file, hello.c or hello, and then: wq to save and exit, if you can't exit, this prompt keeps appearing

 

It means that it cannot be saved.

The reason is that the permissions are not enough, ordinary users cannot save with vi, and they need to use a super user to do so.

Command: sudo su to convert to superuser

           vi hello Open the file: wq to save and exit

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326312335&siteId=291194637