To display the line numbers in the left margin of a vi document,type :set nu. To turn them off again, type :set nonu
Found from the weblink :http://astrowww.phys.uvic.ca/~ehayashi/linux/vi/