> ## Content Index
> Fetch the complete content index at: https://itsfoss.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Go to the Beginning or End of the File in Vim
- URL: https://itsfoss.com/vim-go-start-end-file/
- Published: 2023-10-21T03:27:07.000Z
- Updated: 2023-10-21T03:27:07.000Z
- Description: In this quick Vim tip, learn how to quickly move to the end or beginning of a file.
- Author: Sagar Sharma
- Tags: Vim, #hide

While making changes to the configuration file, most users will add new lines at the end of the file. Sure you can use the down arrow key multiple times to get there but that's not practical. 

The same goes for going to the beginning of the file!

But Vim is one of the most powerful text editors, you are already given multiple options to jump to the beginning or to the end of the file in Vim.

First press the `Esc` key to switch to the normal mode and then use the following actions to get the desired output:

| **Action**        | **Description**                         |
| ----------------- | --------------------------------------- |
| gg or \[\[        | Go to the beginning of the file.        |
| Ctrl + End        | Go to the end of the file.              |
| Shift + g or \]\] | Jump to the beginning of the last line. |

Want more details? Here you have it.

## Go to the beginning of the file in Vim

I assume you already have opened the file inside Vim and if you didn't, you can use the vi command in the following manner to do so:

```
vi Filename
```

Press the `Esc` key to switch to the normal mode which will allow us to use Vim keybindings. 

Now, there are two ways you can go to the beginning of the file in Vim:

1. By pressing `gg`
2. By pressing `[[`

Sure, you can also use `1G` but it requires you to first press `1` and then `Shift + g` (to press trigger capital `G`) which is not productive in any way. 

Once you use any of the shown ways, it will land you at the beginning of the file:

![jump to the beginning of the file in vim](https://itsfoss.com/content/images/2023/10/Jump-to-the-beginning-of-the-file-in-Vim.gif)

As you can see, no matter where I was, once I pressed `[[`, it skipped the cursor to the beginning of the file.

## Go to the end of the file in Vim 

To go to the end of the file, all you have to do is press `Ctrl + End` and it will get you to the end of the file:

![Go to the end of the file in Vim](https://itsfoss.com/content/images/2023/10/Go-to-the-end-of-the-file-in-Vim.gif)

Pretty easy. Right?

### Go to the last line in Vim 

There are times when you want to skip to the last line but to the initial part and in that case, you have two options:

- Press `]]`
- Press `Shift + g` (to trigger capital G)

Once you use any of these shown ways, here's what you should expect:

![Go to the beginning of the last line in Vim](https://itsfoss.com/content/images/2023/10/Go-to-the-beginning-of-the-last-line-in-Vim.gif)

Pretty easy. Right?

## Beginner to Vim? Let me help

The new Vim users are often overwhelmed with the amount of keybindings and different workflow compared to other text editors like Nano.

To tackle this situation, we made [a beginner's guide to the Vim editor](https://itsfoss.com/nano-editor-guide/) addressing all the basic parameters of Vim to kickstart your journey:

[Editing Files With Nano in Linux \[With Cheat Sheet\]Though Nano is less complicated to use than Vim and Emacs, it doesn’t mean Nano cannot be overwhelming. Learn how to use the Nano text editor.![](https://itsfoss.com/content/images/size/w256h256/2022/12/android-chrome-192x192.png)It's FOSSAbhishek Prakash![](https://itsfoss.com/content/images/wordpress/2020/05/nano-editor-guide.png)](https://itsfoss.com/nano-editor-guide/)

Here's a [cheat sheet to the Vim keybindings](https://linuxhandbook.com/vim-cheat-sheet/?ref=itsfoss.com):

[Awesome Vim Cheat Sheets to Help You Learn VimA useful collection of Vim cheat sheets to help you learn Vim editor faster. You can use them and download them for free.![](https://linuxhandbook.com/content/images/size/w256h256/2021/08/Linux-Handbook-New-Logo.png)Linux HandbookAbhishek Prakash![](https://linuxhandbook.com/content/images/2022/10/vim-cheatsheets.png)](https://linuxhandbook.com/vim-cheat-sheet/?ref=itsfoss.com)

I hope this will help you become a better Vim user (so you can flaunt your Vim skills).