How to Show Line Numbers in Vi / Vim editor

Showing Line numbers in Vi /Vim Text editor would be very helpful when it comes to troubleshooting code errors in a file. This works on almost all Linux/UNIX distributions. Once you are in the edit file mode, Type while in edit mode ":set nu" OR ":set number" and then it will show you the Line numbers and  then you can jump to a specific line by typing ":number" or any line number you require.

 Before setting Line Numbers:

vi screen 1

After enabling Line numbers using :set nu (OR) :set number

vi screen 2

If you want edit specfic line, use ":number" i.e. ":10"or any line number required.

vi screen 3

If you encounter any errors during the process, let us know via Contact Us and will try our best to help.

Most Read Articles

Add/Detect a new disk in ...

Written By Farooq Mohammed Ahmed on Sunday, 11 January 2015 19:22
Add/Detect a new disk in ...

Replace SSL Certificates ...

Written By Farooq Mohammed Ahmed on Friday, 16 December 2016 08:05
Replace SSL Certificates ...

Using awk in Alias Comman...

Written By Farooq Mohammed Ahmed on Friday, 19 February 2016 14:22
Using awk in Alias Comman...

Script to Monitor Nagios ...

Written By Farooq Mohammed Ahmed on Monday, 18 July 2016 22:48
Script to Monitor Nagios ...

Generate/Create a SHA2/SH...

Written By Farooq Mohammed Ahmed on Tuesday, 25 October 2016 13:56
Generate/Create a SHA2/SH...