commands

nl — number lines

Number lines using configurable numbering styles; -ba numbers all body lines including blank ones. Default output includes padding and a tab. Logical section delimiters have special meaning. Example assumes a fresh text-streams lab fixture.

Formal Syntax & Structure

linux syntaxlinux
nl [OPTION]... [FILE]...

Parameters & Attributes

NameTypeDescription
-boptionBody numbering style
FILEoperandInput file

Return Value

exit status and output

GNU nl writes text with selected line numbering and returns nonzero on read/write errors. A successful result can contain unnumbered lines under the selected numbering style.

Working Example

Example Snippetlinux
nl -ba events.txt
Linux Reference