Vim e212 Error

Source: Internet
Author: User

First, this error is caused by your own carelessness. when creating the file, you use the root permission and find that WQ cannot save and exit after editing in VI. The error e212 is displayed: the file cannot be opened and written. I have not run commands in VI before, and switched to the tailline mode. W! Sudo tee % and press enter to select L as prompted.

The principle of this command is as follows:

Percent sign ("%") indicates the current file name

Follow the prompts in man VIM:

: [Range] W [rite]! {Cmd} Execute {cmd} with [range] lines as standard input (note the space in front of '! '). {Cmd} isexecuted like with ":! {Cmd} ", any '! 'Is replaced withthe previous command': W! Sudo tee % "indicates that the content of the currently edited file is input as a standard input to the sudo tee file name, that is, sudo is saved as the current file name ==== ========================================================== ========================================================== ====================================== I checked the folder permissions later, only the root user has the write execution permission, so the owner chown-r groupname of the folder is changed. username filename can replace the group name, user name, and file name.-R is used to recursively execute commands on all subdirectories or files in the filename folder.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.