{
    "mode": "man",
    "parameter": "nl",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/nl/1/json",
    "generated": "2026-06-02T20:21:54Z",
    "synopsis": "nl [OPTION]... [FILE]...",
    "sections": {
        "NAME": {
            "content": "nl - number lines of files\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "nl [OPTION]... [FILE]...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Write each FILE to standard output, with line numbers added.\n\nWith no FILE, or when FILE is -, read standard input.\n\nMandatory arguments to long options are mandatory for short options too.\n",
            "subsections": [
                {
                    "name": "-b --body-numbering",
                    "content": "use STYLE for numbering body lines\n",
                    "flag": "-b",
                    "long": "--body-numbering"
                },
                {
                    "name": "-d --section-delimiter",
                    "content": "use CC for logical page delimiters\n",
                    "flag": "-d",
                    "long": "--section-delimiter"
                },
                {
                    "name": "-f --footer-numbering",
                    "content": "use STYLE for numbering footer lines\n",
                    "flag": "-f",
                    "long": "--footer-numbering"
                },
                {
                    "name": "-h --header-numbering",
                    "content": "use STYLE for numbering header lines\n",
                    "flag": "-h",
                    "long": "--header-numbering"
                },
                {
                    "name": "-i --line-increment",
                    "content": "line number increment at each line\n",
                    "flag": "-i",
                    "long": "--line-increment"
                },
                {
                    "name": "-l --join-blank-lines",
                    "content": "group of NUMBER empty lines counted as one\n",
                    "flag": "-l",
                    "long": "--join-blank-lines"
                },
                {
                    "name": "-n --number-format",
                    "content": "insert line numbers according to FORMAT\n",
                    "flag": "-n",
                    "long": "--number-format"
                },
                {
                    "name": "-p --no-renumber",
                    "content": "do not reset line numbers for each section\n",
                    "flag": "-p",
                    "long": "--no-renumber"
                },
                {
                    "name": "-s --number-separator",
                    "content": "add STRING after (possible) line number\n",
                    "flag": "-s",
                    "long": "--number-separator"
                },
                {
                    "name": "-v --starting-line-number",
                    "content": "first line number for each section\n",
                    "flag": "-v",
                    "long": "--starting-line-number"
                },
                {
                    "name": "-w --number-width",
                    "content": "use NUMBER columns for line numbers\n\n--help display this help and exit\n",
                    "flag": "-w",
                    "long": "--number-width"
                },
                {
                    "name": "--version",
                    "content": "output version information and exit\n\nDefault options are: -bt -d'\\:' -fn -hn -i1 -l1 -n'rn' -s<TAB> -v1 -w6\n\nCC  are  two delimiter characters used to construct logical page delimiters; a missing second\ncharacter implies ':'.\n\nSTYLE is one of:\n\na      number all lines\n\nt      number only nonempty lines\n\nn      number no lines\n\npBRE   number only lines that contain a match for the basic regular expression, BRE\n\nFORMAT is one of:\n\nln     left justified, no leading zeros\n\nrn     right justified, no leading zeros\n\nrz     right justified, leading zeros\n",
                    "long": "--version"
                }
            ]
        },
        "AUTHOR": {
            "content": "Written by Scott Bartram and David MacKenzie.\n",
            "subsections": []
        },
        "REPORTING BUGS": {
            "content": "GNU coreutils online help: <https://www.gnu.org/software/coreutils/>\nReport any translation bugs to <https://translationproject.org/team/>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright © 2020 Free Software Foundation, Inc.  License GPLv3+: GNU GPL version 3  or  later\n<https://gnu.org/licenses/gpl.html>.\nThis  is free software: you are free to change and redistribute it.  There is NO WARRANTY, to\nthe extent permitted by law.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "Full documentation <https://www.gnu.org/software/coreutils/nl>\nor available locally via: info '(coreutils) nl invocation'\n\n\n\nGNU coreutils 8.32                          January 2026                                       NL(1)",
            "subsections": []
        }
    },
    "summary": "nl - number lines of files",
    "flags": [
        {
            "flag": "-b",
            "long": "--body-numbering",
            "arg": null,
            "description": "use STYLE for numbering body lines"
        },
        {
            "flag": "-d",
            "long": "--section-delimiter",
            "arg": null,
            "description": "use CC for logical page delimiters"
        },
        {
            "flag": "-f",
            "long": "--footer-numbering",
            "arg": null,
            "description": "use STYLE for numbering footer lines"
        },
        {
            "flag": "-h",
            "long": "--header-numbering",
            "arg": null,
            "description": "use STYLE for numbering header lines"
        },
        {
            "flag": "-i",
            "long": "--line-increment",
            "arg": null,
            "description": "line number increment at each line"
        },
        {
            "flag": "-l",
            "long": "--join-blank-lines",
            "arg": null,
            "description": "group of NUMBER empty lines counted as one"
        },
        {
            "flag": "-n",
            "long": "--number-format",
            "arg": null,
            "description": "insert line numbers according to FORMAT"
        },
        {
            "flag": "-p",
            "long": "--no-renumber",
            "arg": null,
            "description": "do not reset line numbers for each section"
        },
        {
            "flag": "-s",
            "long": "--number-separator",
            "arg": null,
            "description": "add STRING after (possible) line number"
        },
        {
            "flag": "-v",
            "long": "--starting-line-number",
            "arg": null,
            "description": "first line number for each section"
        },
        {
            "flag": "-w",
            "long": "--number-width",
            "arg": null,
            "description": "use NUMBER columns for line numbers --help display this help and exit"
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "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 ':'. 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"
        }
    ],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Number lines from a file or from `stdin`.",
        "examples": [
            {
                "description": "Number non-blank lines in a file",
                "command": "nl {{path/to/file}}"
            },
            {
                "description": "Read from `stdin`",
                "command": "{{command}} | nl -"
            },
            {
                "description": "Number [a]ll [b]ody lines including blank lines or do [n]ot number [b]ody lines",
                "command": "nl -b {{a|n}} {{path/to/file}}"
            },
            {
                "description": "Number only the [b]ody lines that match a basic `regex` (BRE) [p]attern",
                "command": "nl -b p'FooBar[0-9]' {{path/to/file}}"
            },
            {
                "description": "Use a specific [i]ncrement for line numbering",
                "command": "nl -i {{increment}} {{path/to/file}}"
            },
            {
                "description": "Specify the line numbering format to [r]ight or [l]eft justified, keeping leading [z]eros or [n]ot",
                "command": "nl -n {{rz|ln|rn}}"
            },
            {
                "description": "Specify the line numbering's [w]idth (6 by default)",
                "command": "nl -w {{col_width}} {{path/to/file}}"
            },
            {
                "description": "Use a specific string to [s]eparate the line numbers from the lines (`TAB` by default)",
                "command": "nl -s {{separator}} {{path/to/file}}"
            }
        ]
    }
}