Use VI command on Linux to modify a file content, found that can not save, each time the use of ": q!" command can exit normally but use ": wq!" When the command saves the file and exits, a message appears:
E212:can ' t open file for writing press ENTER or type command to continue
There may be two reasons for this error:
1. Insufficient permissions for current user
2. This file may be in use by another program or user.
The common cause of error is the former, the solution is to open the file with the VI command, the front plus sudo to temporarily provide administrator rights, such as using the command "sudo VI hosts" to open the editing file.
In this sense, sudo commands are very useful, and when we perform some kind of operating system prompts such as "Operation not permitted" and other insufficient information, we can often in front of the command with sudo to solve the problem of insufficient permissions. For example, when we download a file from the Linux server or upload a file may be prompted this, but also willing to upload the direct unsuccessful but nothing prompted, then you should consider whether the account is not sufficient authority, add a sudo try.