How to Show Line Numbers in Vi / Vim editor

by | Feb 5, 2015 | Linux

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.

Related Articles….