vi / vim: Jump To End Of File Command

last updated in Categories , ,

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 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):
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
You can jump to line number 700 (press ESC type 700G)

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

11 comment

  1. 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?

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

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

  2. 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!

  3. 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.

    Still, have a question? Get help on our forum!