首先输入vi +文件名
进入文件里以后输入 :set nu
这样就可以了,是不是很简单
Linux如何在vi打开文件显示行数
原文:https://www.cnblogs.com/linyu51/p/13957051.html