3.4 实训:使用vi编辑器创建并编辑文档
1. Open the file in the terminal directory.
Find a file entry, for example: vi man_db.conf to enter this command
as shown:
to enter the page like this:
2. Open Vi vi man_db.conf in the current directory
as shown:
3. Set at the line number in vi.
Executed in the current directory: set nu command
in the following direct: set nu
and then press Enter:
4. Move to line 58, to move to 40 characters to the right, within the quotation marks to see what directory?
First press 58G, the press 40 →.
There is no 40 →
5 to the first line, and the search string number bzip2 down, will he in the first few lines?
1G or first implementation of the first row gg to directly input / bzip2
will be directly input in the bottom of the current page.
But we do not have this can be found here.
6. The man between 50 to 100 lines changed MAN, and whether you need to modify one by one to pick, how to place an order?
Direct execution: 50,100s / man / MAN / gc to (performed in line mode)
directly to the line 50 to the inside of the man 100 MAN changed
by a direct all of the off press y may be changed one by one, by u direct the full reinstatement.
7. After you finish modifying, suddenly go back on, requiring the full reinstatement, in what ways.
The simplest way to restore the original appearance by u directly, do not save the command: q! Left, read the file again.
8. Copy lines 51 to 60 that the contents of the line 10, and then attached to the last row.
51G and then again after the selection performed by 10yy G, the last line, and then paste the contents of line 10.
As shown in the last line has been re-copy the contents of the line 10. You can see whether the 10 lines of the same content.
9. Remove the line 20 between lines 11 and 30.
After performing 11G, then 22dd to delete 20 lines
10. This document will be saved as a file man.text.config.
Directly in the line mode execution: w man.text.config command.
Display as shown:
11 to line 29 and delete 15 characters.
After performing 29G, then you can delete 15x 15 characters.
12. leave without saving
: q!