Show Line Numbers with Vi

Show Line Numbers with Vi

Show Line Numbers with Vi

This is a fairly common task. Usually when you are configuring an application, you will get something that says like “now go to line 293 and change this word….” if you are only counting by hand, that’s quite a goal to accomplish. Here’s the quick and easy way

this can be done logged in as any user

Vi editor showing line numbers 1

let’s edit the sample file OffsiteBackup.sh

Vi editor showing line numbers 2

as you can see there are many lines in this script

Vi editor showing line numbers 3

Let’s hit our magic keys, CTRL+C

Vi editor showing line numbers 4

you should notice the above appear at the bottom of you screen

from here enter :set nu, and hit enter

Vi editor showing line numbers 5

there we have it, line numbers in our VI window!

Vi editor showing line numbers 6

That’s it!

Hosted Linux Servers at www.zwiegnet.com/go

Related guides: find shared libraries for binary ldd · Downgrade package CentOS 6 · Developing Applications for RHEL/CentOS

1 Comment

Leave a Reply

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