www.LinuxHowtos.org
NL
Section: User Commands (1)Updated: February 2026
Index Return to Main Contents
NAME
nl - number lines of filesSYNOPSIS
nl [,OPTION/]... [,FILE/]...DESCRIPTION
Write each FILE to standard output, with line numbers added.
With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too.
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-b'-b, --body-numbering=,STYLEX'tty: link'/
- use STYLE for numbering body lines
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-d'-d, --section-delimiter=,CCX'tty: link'/
- use CC for logical page delimiters
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-f'-f, --footer-numbering=,STYLEX'tty: link'/
- use STYLE for numbering footer lines
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-h'-h, --header-numbering=,STYLEX'tty: link'/
- use STYLE for numbering header lines
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-i'-i, --line-increment=,NUMBERX'tty: link'/
- line number increment at each line
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-l'-l, --join-blank-lines=,NUMBERX'tty: link'/
- group of NUMBER empty lines counted as one
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-n'-n, --number-format=,FORMATX'tty: link'/
- insert line numbers according to FORMAT
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-p'-p, --no-renumberX'tty: link'
- do not reset line numbers for each section
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-s'-s, --number-separator=,STRINGX'tty: link'/
- add STRING after (possible) line number
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-v'-v, --starting-line-number=,NUMBERX'tty: link'/
- first line number for each section
- X'tty: link https://www.gnu.org/software/coreutils/manual/coreutils.html#n-w'-w, --number-width=,NUMBERX'tty: link'/
- use NUMBER columns for line numbers
- X'tty: link https://www.gnu.org/software/coreutils/nl#n-help'--helpX'tty: link'
- display this help and exit
- X'tty: link https://www.gnu.org/software/coreutils/nl#n-version'--versionX'tty: link'
- output version information and exit
Default options are: -bt -d':' -fn -hn -i1 -l1 -n'rn' -s<TAB> -v1 -w6
CC are two delimiter characters used to construct logical page delimiters; a missing second character implies ':'. As a GNU extension one can specify more than two characters, and also specifying the empty string (-d '') disables section matching.
STYLE is one of:
- a
- number all lines
- t
- number only nonempty lines
- n
- number no lines
- pBRE
- number only lines that contain a match for the basic regular expression, BRE
FORMAT is one of:
- ln
- left justified, no leading zeros
- rn
- right justified, no leading zeros
- rz
- right justified, leading zeros
AUTHOR
Written by Scott Bartram and David MacKenzie.REPORTING BUGS
Report bugs to: bug-coreutils@gnu.org
Report Gentoo bugs to: https://bugs.gentoo.org/
GNU coreutils home page: <https://www.gnu.org/software/coreutils/>
General help using GNU software: <https://www.gnu.org/gethelp/>
Report any translation bugs to <https://translationproject.org/team/>
SEE ALSO
Full documentation <https://www.gnu.org/software/coreutils/nl>or available locally via: info aq(coreutils) nl invocationaq
Packaged by Gentoo (9.10 (p0))
Copyright © 2026 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.