Viewing Content

nl

Numbers lines of text.

nl adds line numbers with more formatting control than cat -n.

Syntax
nl [options] [file]

Arguments explained

  • Options adjust output or behavior.
  • Arguments name the files, services, hosts, or values the command should work with.

Common examples

Number a file
nl script.sh

Prints script.sh with line numbers.

Number all lines
nl -ba notes.txt

Numbers blank and nonblank lines.

nl Command
FieldDetails
Commandnl
CategoryViewing Content
Primary useNumbers lines of text.
Syntaxnl [options] [file]