NL(1)
π NL(1) β numbering lines of files, but make it cute π
okay bestie so you know that thing where you've got a file and you're like "hmm what if every line had a little number next to it"? that's nl, and it's from the General Commands Manual. she's giving very much "annotated homework" energy and honestly? we're obsessed. β¨
πΈ NAME πΈ
nl β number the lines of files. that's it. that's the whole job. she does one thing and she does it flawlessly.
π SYNOPSIS π
nl [OPTION]... [FILE]...
yes literally that's it. options then files, the classic lil combo. π
π¦ DESCRIPTION π¦
Number lines of files.
that's the tea. she numbers. lines. of files. iconic behavior, no notes fr fr.
β¨ OPTIONS β¨
--helpβ prints help info so you're not out here lost in the sauce π-b,--body-numbering <STYLE>β tell her which STYLE to use when numbering the body lines-d,--section-delimiter <CC>β use CC as the thing that separates your logical pages-f,--footer-numbering <STYLE>β use STYLE for numbering the footer lines-h,--header-numbering <STYLE>β use STYLE for numbering the header lines-i,--line-increment <NUMBER>β how much the line number jumps up at each line-l,--join-blank-lines <NUMBER>β a group of NUMBER empty lines gets counted as just one-n,--number-format <FORMAT>β drop the line numbers in according to FORMAT
possible values are:
lnrnrz
-p,--no-renumberβ do not reset the line numbers at logical pages-s,--number-separator <STRING>β stick STRING after the (possible) line number-v,--starting-line-number <NUMBER>β what number each logical page starts on-w,--number-width <NUMBER>β give the line numbers NUMBER columns to live in-V,--versionβ prints the version, obvi
π EXTRA π
STYLE is one of:
aβ number all the linestβ number only the nonempty lines (the only-valid-ones vibe)nβ number no lines, king of doing nothingpBREβ number only the lines that contain a match for the basic regular expression,BRE
FORMAT is one of:
lnβ left justified, no leading zerosrnβ right justified, no leading zerosrzβ right justified, leading zeros
π VERSION π
v(uutils coreutils) 0.12.0
π₯ EXAMPLES π₯
okay this is the part where it gets good. the tldr-pages girlies really came through with these.
Number non-blank lines in a file:
nl path/to/file
Read from stdin:
command | nl -
Number [a]ll [b]ody lines including blank lines or do [n]ot number [b]ody lines:
nl -b a|n path/to/file
Number only the [b]ody lines that match a basic regex (BRE) [p]attern:
nl -b p'FooBar[0-9]' path/to/file
Use a specific [i]ncrement for line numbering:
nl -i increment path/to/file
Specify the line numbering format to [r]ight or [l]eft justified, keeping leading [z]eros or [n]ot:
nl -n rz|ln|rn
Specify the line numbering's [w]idth (6 by default):
nl -w col_width path/to/file
Use a specific string to [s]eparate the line numbers from the lines (TAB by default):
nl -s separator path/to/file
bestie. listen. these examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. and also, because uutils is a work in progress, some examples might fail. not her fault, she's growing. π«Ά
k that's the whole page, my love. this lil queen dropped on 2026-09-25 and she's running on uutils coreutils, so go forth and number some lines. you're gonna slay so hard πβ¨ππ¦πΈπ π
π¦ where this page comes from
- ubuntu stonking: rust-coreutils 0.12.0-1ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms