vi / vim: Jump To End Of File Command

See all VI / Vim text editor related FAQs/HowTos
I‘m using vim as a text editor and editing a large code file written in python. How do I jump to end of file using vim text editor under Apple Mac OS X Unix or Linux operating systems?

You can save a lot of time by using appropriate movement commands in vi or vim text editor. For large file the cursor keys are not the best choice. To move to end of file just type G (press ESC and type capital G):
G
Sample outputs (jumping from 1st line to line # 82):
Fig.01: vi/vim command demo for EOL jump

Fig.01: vi/vim command demo for EOL jump

You can jump back to beginning of file by typing any one of the following command
1G
OR gg
gg
You can jump to line number 700 (press ESC type 700G)
700G
Advertisement

Move cursor to end of file in vim

In short press the Esc key and then press Shift + G to move cursor to end of file in vi or vim text editor under Linux and Unix-like systems. However, you can use the following keyboard shortcuts too.

Conclusion

  • Esc + Ctrl + End – Jump end of file
  • Hit Esc + Ctrl + Home : Jump start of file
  • Press Esc + gg : Go to top the file
  • Esc + G : Go to bottom of the file
  • Esc + G + A : Go to bottom of the file and in append text mode. In other words, jump to last line and start writing code/text.
  • Hit Esc + A + $ : Go to bottom of the file and end of line.

In this quick tutorial, you learned how to move to the last character of the file. Now you know how to jump to the end of the file using the vim command. We also explained how to jump to the start of the file using the vim text editor, including various keyboard shortcuts combinations. If you have any problems or concerns, let us know in the comment section below.

🥺 Was this helpful? Please add a comment to show your appreciation or feedback.

nixCrat Tux Pixel Penguin
Hi! 🤠
I'm Vivek Gite, and I write about Linux, macOS, Unix, IT, programming, infosec, and open source. Subscribe to my RSS feed or email newsletter for updates.

13 comments… add one
  • Ashraf Aug 14, 2013 @ 9:25

    Thank you for giving a very informative note…

  • goja gattis Mar 3, 2014 @ 16:07

    it takes you to the begining of the last line of the file. how can i reach the end of the last line of the file?

    • pifou Oct 15, 2014 @ 13:24

      To reach the end of a line, just press they “end” key.
      “end” and “home” are very useful for keyboard navgation.

      • biz Oct 22, 2014 @ 5:38

        GA – to go to the end of the last line
        or
        Go – to go to a new line after the last line

        • Daniel Thomas Mar 23, 2015 @ 17:19

          How about a built in that combines G$ into a single keystroke? I don’t always want to append.

  • JD Dec 9, 2014 @ 21:47

    Thanks from me as well.
    This result justifiably shows high on google results.

  • Pra Jun 26, 2015 @ 12:25

    P’fect!! This is exactly I was looking for!.

    Thank you very much for the video.

  • nishit manvar Jul 10, 2015 @ 11:47

    Perfect..!!

    thanks for your help :)

  • Scott Sep 10, 2015 @ 12:41

    Worked perfectly!! Thanks for posting this simply, yet hard-to-find command. I moved to the bottom of a 40,650 line log file in less than a second!

  • James Oct 6, 2015 @ 10:08

    This is an excellent example of a difference where one can spend monstrous amount of time in linux unless they’re quite good with linux. Luckily, because this to-the-pont useful article ranks high on the internet, this particular issue will be much easier to solve for those googling for help to navigate through logs containing hundreds of thousands of lines or more, where tail command won’t offer them a proper help for some specific circumstances.

    Unfortunately, there are many other seemingly “easy” linux tasks that pose a nightmare because solution is not easy to find for anyone besides those “intermediate” users who are extremely accustomed to vi editor and/or they have a strong clue how to solve it.
    VI editor is a nightmare for any beginner and many intermediate linux users for a reason, depsite its versatility and powerful features that it offers for top experts.

  • Priyanga Oct 27, 2016 @ 1:16

    Thanks a lot!

  • Joe Taylor Oct 20, 2020 @ 10:55

    VI VI VI editor of the beast

  • MimicTheDon Jul 15, 2022 @ 17:13

    Precise and informative. Saved a lot of time. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

Use HTML <pre>...</pre> for code samples. Your comment will appear only after approval by the site admin.