The use of the VI command on Linux to modify a file content, found unable to save, each time after the use of ": q!" command can exit normally but use ": wq!" command to save the file and exit when the message appears:
E212:can ' t open file for writing press ENTER or type command to continue
There can be two reasons for this error:
1. Insufficient permissions for the current user
2. This file may be in use by another program or user.
The general cause of the error is the former, the solution is to open the file with the VI command, preceded by sudo to provide temporary administrator privileges, such as the use of the command "sudo VI hosts" to open the editing file.
As a result, the sudo command is useful, and when we perform some kind of operating system hint such as "Operation not permitted" and other insufficient rights, we can often add sudo to the command to resolve the problem of insufficient permissions. For example, when we download a file from a Linux server or upload a file may prompt this, there is a direct upload can not be successful but nothing prompt, then you should think about the account is not enough permissions, add a sudo try.
Linux operation Tip: "Can ' t open file for writing" or "Operation not permitted" workaround