The g command is the junk drawer of commands, but the basics of it is that it can take you to specific spots and in a file.

The g command by itself won't do anything, it requires a motion.

g+g

This will take you to the first line in a file.

Capital G

This will take you to the last line in the file.

34 Capital G

You can also move to a specific line in a text file by prefixing it the number of the line.

Note: If you don't see lines in the file it means that the number line options is turn off. To turn them on you type:

:set number

There are many other things you can do with the g command like

g + CTRL-G

This will give you more detailed info on the specific line in that file.