unix

How do I display line numbers of a file on my Linux server?

Sometimes having line numbers can be useful. The nl command is helpful in this case, but depending on whether or not it’s the GNU version may mean that blank lines are not counted.

To get around this issue, you can issue the command below:

nl -ba

If you’re running GNU nl then you likely won’t have that issue and a simple

nl

will work.

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top