Vi is a commonly used text editing method in Linux, just like using txt in Windows.
Of course, you can use the mouse in Windows, but in the Linux server System (the server does not select the interface), we have to use commands to provide us with a quick start. The following is an introduction:
Vi haha creates a file named haha in the current directory, just like inputting notepad in windows running. It needs to be saved before it can be created.
After entering the text, I is in the command line status and cannot edit the text. Press the I key to edit the text.
After wq is edited, save and exit. Press esc to enter the command line status. Press: To enter wq.
Q: If you do not perform any operations on the text, you can exit the command line.
Q! If you do not want to save the edited text, you can: q! In the command line status! Force exit
/Port in the command line state, enter/port to quickly search for the port keyword location in the text. If there are multiple related keywords in the text
: 50 enter: 50 in the command line status to directly jump to the 50th lines of text. This is also a frequently used command.
: If set nu is input in the command line status, the text will display the row number, and you will know it if you try.
Dd in the command line state, you can delete the current line by pressing dd in the row where the cursor is located.
In the command line status, you can press dG to delete all content in the text.