Differences between the ': wq' and': x' command for saving vi files in Linux

Source: Internet
Author: User
In Linux, save the vi file and exit the Command & amp; #39;: wq & amp; #39; and & amp; #39;: x & amp; #39; vi File Save exit Command & amp; #39;: wq & amp; #39; and & amp; #39;: x & amp; #39; 2011-04-0816: 41vi is one of the most commonly used editors in UNIX/Linux systems. I am used to saving vi files in Linux and exiting the command ': wq' and ': x' difference vi is one of the most common editors in UNIX/Linux systems. I am used to using the ": x" command to save the file and exit. I don't want to use it ": the wq command is used to knock on a letter.
But today I know the real difference between ": x" and ": wq", as follows:
: Wq is mandatory to write files and exit. Write the file forcibly even if it is not modified, and update the modification time of the file. Www.2cto.com: x write the file and exit. The file is written only when the file is modified and the file modification time is updated. Otherwise, the file modification time is not updated. In general, the two are not the same, but programming may have an important impact on editing source files. Even if the file is not modified, ": wq" forces the update of the file's modification time, which will make the entire project to assume that the file has been modified, then you have to recompile the link to generate an executable file. This may cause people to misunderstand the consequences. of course, it also produces unnecessary system resource costs. This article is from the fat shark network.

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.