Wednesday, August 31, 2016

Display line numbers in a file

$ cat -n filename.txt

It will display line numbers on the left hand side for each line in a file


If you want to display line numbers in vi editor

$ vi +linenumber filename.txt

In command mode you just type :set nu to display line numbers

No comments:

Post a Comment