nl

Number lines from a file or from stdin. More information: https://manned.org/nl.1p.

nl path/to/file

command | nl -

nl -b a|n path/to/file

nl -b p'FooBar[0-9]' path/to/file

nl -i increment path/to/file

nl -n rz|ln|rn

nl -w col_width path/to/file

nl -s separator path/to/file