Home  >  Article  >  Operation and Maintenance  >  How to save and exit after editing a file in Linux

How to save and exit after editing a file in Linux

藏色散人
藏色散人Original
2020-02-27 09:44:2918396browse

How to save and exit after editing a file in Linux

How to save and exit after editing a file in Linux?

The command is wq to save and exit.

First press ESC to enter Command mode, then enter ":wq" and press Enter to save and exit.

Recommended: "Linux Tutorial"

vi has different options for saving files, corresponding to different commands. You can use the following command Select a required input:

1. wq to save the file and exit vi

2. w to save the file but not exit vi

3. w file to save the modifications separately. to file, do not exit vi

4, q do not save the file, exit vi

and finally press Enter.

Extended information

Exit Vi When you finish editing the file and prepare to exit Vi and return to the shell, you can use one of the following methods. Click the capital letter Z twice in the command mode. If you are currently editing If the file has been modified, Vi saves the file and exits back to the shell.

If the currently edited file has not been modified, Vi will exit directly and return to the shell. Enter the command in the last line mode: w. Vi saves the currently edited file but does not exit but continues to wait for the user to enter the command before using w. You can give the edited file a new file name when issuing the command.

Linux is a free-to-use and freely disseminated Unix-like operating system. It is a multi-user, multi-task, multi-thread and multi-CPU operating system based on POSIX and UNIX. It can run major UNIX software tools, applications and network protocols. It supports 32-bit and 64-bit hardware. Linux inherits the network-centric design philosophy of Unix and is a multi-user network operating system with stable performance.

Strictly speaking, the word Linux itself only refers to the Linux kernel, but in fact people are accustomed to using Linux to describe the entire operating system based on the Linux kernel and using various tools and databases of the GNU Project.

For more programming related content, please pay attention to the Programming Introduction column on the php Chinese website!

The above is the detailed content of How to save and exit after editing a file in Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn