vi Movement
Linux Commands - Shells

There are three operational modes for vi. When you first open vi, it will be in the command mode. To edit a file, you'll need to switch it to the insert mode. Finally, to save the file, you'll need to switch to the last-line mode. When you first open vi, it will be in command mode. These four keys will move the cursor for you.  Choose these keys by themselves in command mode and they will move one space.  But you can use a “force multiplier”.  Add a number before letter and you will move the corresponding spaces or lines.


H    left
J    down
K    up
L    right


Here are some examples that you can use in command mode.  
H by itself will move the cursor left one space, but 6h will move 6 spaces to the left. K will move up one line but 10k will move up 10 lines.  J will move down one line but 25j will move down lines.  L will move right one space but 3l will move right 3 spaces.

By Character
You can move by character and use numbers in addition in order to move greater distances.
left,down,up,right                                           h ,  j , k , l
add number to letter                                  nh , nj , nk , nl
forward, back to character                                      fc , Fc
By Word
Moving by word can also use numbers to enhance movement.
next word, blank delimited word                            w , W
begin of word, begin of delimited word                  b , B
end of word, end of blank delimited word              e , E
By Line
move to line number n                                          nG , :n
first or last position on line                                        0,$
sentence before, sentence forward                             ( , )
paragraph before, forward                                         { , }
begin of file, end                                                   1G , G
By Screen
scroll forward, scroll back one screen                  ^F , ^B
scroll forward, scroll back half screen                 ^D , ^U


The G is the (Go To) command.
Use the line number you want to go to and the shift+G to move to that line.  The command below will move you to the start of line 34.

34(shift+G)

The command looks like this on the screen.
34G

The shift+G command takes you to the end of the file.  While Ctrl+G will show you the line numbers in the file.

Ctrl+G
"text.conf" 1022 lines --6%--