What is the keyboard shortcut to go to the end of the file in vi?

I'm using putty to view a 30+MB file in vi on a Linux server, and I have to use PgDn to scroll to the bottom of the page. I realize I can use tail but I want to be able to move up and down the file with it open in vi. Is there not a way to go to end of file or top of file immediately using a keyboard shortcut?

3 Answers

The key for the end of file is G (uppercase g).

See vi cheat sheet, for example.

The answer is a simple G in normal mode. That is capital G, not g.

You can also open a file and directly go to the end of it using:

vim +$ thefile 
1

Type vimtutor or inside the editor :help

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like