Move or jump to specific lines in vi
Navigating large files is an important capability when using any editor. The vi editor makes it easy to move around.
All of the following commands must be entered in command mode, not insert mode. Pressing ESC will ensure you are in command mode.
To jump to the end (last line) of a document:
G
To move to the first line of a document:
0G
This is a special case of the more general command to move to any specific line. To jump to the 3872nd line:
3872G








anon said on February 13, 2009
This doesnt work.
mgumgu said on September 1, 2009
Thanks for the very helpful info! Though i noticed that when i type 0G i still jump to the end of the file. But to go to the beginning i need to type 1G instead. Thought i should share. Cheers!
sandy said on November 30, 2011
In vi editor, go to command mode (by pressing Esc), then try “:”
for example
:565 jumps to 565th line
:78 jumps to 78th line
note: If it doesnt work,
ctrl+g
then follow same steps as i mentioned above.