Focus on cloud service provider activities
Notes on website operation and maintenance

Organize 10 common Linux Vi editor commands

When we use a Linux server, if there are documents that need to be edited, we do not need to download them to local editing. Instead, edit directly with the vi editor. Here are some common command tools to remember.

1. Open file: vi filename

This command will open the specified file.

2. Insert text: i

Insert text before the cursor position.

3. Save the file and exit:: wq

This command saves the current file and exits the Vi editor.

4. Do not save the file and exit:: q!

If you have modified the file but do not want to save it, you can use this command to forcibly exit the Vi editor.

5. Cursor movement:

h: Move one character to the left

j: Move one line down

k: Move one line up

l: Move one character right

6. Delete character: x

This command deletes the character where the cursor is located.

7 Delete whole line: dd

This command deletes the cursor line.

8. Copy Row: yy

This command copies the cursor line.

9. Paste: p

This command will paste the previously copied content to the cursor position.

10. Search keyword:/keyword

This command searches for keywords in the file and moves the cursor to the first match.

Vote for you
Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Organize 10 common Linux Vi editor commands