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. There are different options for vi to save files, corresponding to different commands. You can choose the one you need from the following commands: 1. wq saves the file and exits vi 2. w saves the file but does not exit vi 3. w file saves the changes to another file without exiting vi 4. q does not save the file and exits vi Finally, press Enter. Additional information Exit Vi When you have finished editing the file and are ready to exit Vi and return to the shell, you can use one of the following methods: Press the capital letter Z twice in command mode. If the currently edited file has been modified, Vi saves the file and exits to return to the shell. If the currently edited file has not been modified, Vi exits directly and returns to the shell. In the last line mode, enter the command: w Vi saves the currently edited file but does not exit. Instead, it continues to wait for the user to enter commands. When using the w command, you can give the edited file a new file name. Linux is a free to use and free to spread Unix-like operating system. It is a multi-user, multi-tasking operating system based on POSIX and UNIX that supports multi-threading and multi-CPU. It can run major UNIX tools, applications, and network protocols. It supports both 32-bit and 64-bit hardware. Linux inherits the network-centric design concept 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 have become accustomed to using Linux to describe the entire operating system that is based on the Linux kernel and uses various tools and databases of the GNU project. Additional content: For example, if you want to add the content "I am a boy" to the test.txt file, test.txt is in the current directory. Method 1: vi editing method Open the terminal, enter vi test.txt and press Enter. Press a or i to enter the editing mode, enter I am a boy, and then press the Esc key to exit the editing mode. Enter :wq to save and exit. Method 2: echo command method Open the terminal and enter
Note: Append single line text method Method 3: cat command method
Note: The ending EOF must be aligned to the beginning of the letter, appear in pairs, and can be replaced by other characters. Method 4: cat editing method
Press cntl+d to end editing. This is the end of this article about the practical explanation of how to save and exit after editing files in Linux. For more information about how to save and exit after editing files in Linux, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Win32 MySQL 5.7.27 installation and configuration method graphic tutorial
>>: jQuery implements the bouncing ball game
What is serdel userdel is a low-level tool for de...
1. Create insert into [table name] (field1, field...
Linux has been loved by more and more users. Why ...
Unzip the Maven package tar xf apache-maven-3.5.4...
1. Going around in circles After going around in ...
Enable remote access Enable remote access rights ...
Preface As a basic data structure, arrays and obj...
Table of contents No switch, no complex code bloc...
Table of contents 1. Introduction 2. Rendering 3....
Today we are going to create a simple heartbeat e...
Table of contents Hidden Problems Solution to ada...
This article shares with you how to import Excel ...
1) Enter the folder path where the jdk file is st...
In the SQL like statement, for example SELECT * F...
This article shares the specific code of jquery t...