Using the vi Editor

0

 

The vi editor is included with most versions of UINIX and Linux. Its primary use has been for developing computer programs. However, because of its availability with the system, and because it can become a letter-quality word processor, it has been widely used for purpose other than programming. With the vi editor, you can create files, called shell scripts, to assist you with your work in Linux.

Using vi to Edit a File

Type                                                                                          Result     

g                                                                       Move left one character.

j                                                                        Move down one line.

k                                                                       Move up one line.

l                                                                        Move right one character

^                                                                      Move to the beginning of the current line.

$                                                                      Move to the end of the current line.

:1                                                                     Move to the first line in your file.

:$                                                                    Move to the last line in your file.

: number                                                     Move to the line specified. (For example : 15 takes you to the

beginning of line 15.)

w                                                                    Move to the next word.

b                                                                     Move to the previous word.

e                                                                     Move to the end of the current word or to the end of the next

word if you are already at the end of the word.

[Ctrl] U                                                         Move up one-half screen.

[Ctrl] D                                                         Move down one-half screen.

[Ctrl] F                                                          Move down one full screen.

[Ctrl] B                                                          Move up one full screen.

 

You can combine the line, word, and character movement keys with a number to specify how many lines, word, or characters to move at once. For example, 6w moves you forward six words. You can also use the arrow keys to move around. [Home] and [End] move to the beginning and end of the current line. [Page Up] and [Page Down] move to the next and the previous screen.

Share.

About Author

TN365

Leave A Reply

Powered by themekiller.com