How to go to line number in vim - terminal / server

June 10, 2012

In addition to my last post which was how to show line numbers in Vim I soon after wanted to find a way to jump to the line number I knew I needed to edit.

Using a combination of grep -n "blah blah" file.txt which will return the string if found and the line numbers that it was found on.

Armed with the line number from grep I soon found a way to jump to line number in vim.

Simply do the following.

:956 + enter (obviously replacing 956 with whatever your line number is)

And that's all there is to it.

You can jump to the beginning and end of files as well by simply Hitting G.

About me

Hello! I'm David Heward, how are you going? I'm a Senior Devops/Build Engineer, specialising in AWS & Cloud Automation. Based in London. Strong 10+ year background in Software development. Have a read of my blog. Have a look at some of my working projects. Contact me at @davehewy or on Linkedin.