显示行号,除了空行

默认就是这个

nl test.txt
nl -b t test.txt

 

无论是否为空行,都显示行号

nl -b a test.txt

 

行号靠最左显示

nl -n ln test.txt

Linux常用命令 - nl命令详解_Linux系统

 

 

行号靠最右显示

nl -n rn test.txt

Linux常用命令 - nl命令详解_Linux系统_02

 

 

行号靠最右显示,不足位数左边补0

nl -n rz test.txt

Linux常用命令 - nl命令详解_Linux教程_03