Forrest logo
back to the nl tool

nl:tldr:7eea0

nl: Number all lines including blank lines.
$ nl -b a ${filename}
try on your machine

The command "nl -b a ${filename}" is used to add line numbers to a file.

Here is the breakdown of each component of the command:

  • "nl" is the command used to add line numbers to a file.
  • "-b a" is an option of the "nl" command. In this case, it stands for "body numbering style" and "a" specifies that line numbers should be added to all lines, including empty ones.
  • "${filename}" is a placeholder for the actual filename or path of the file on which line numbers need to be added. You would replace ${filename} with the actual file's name or path.

By running this command, the "nl" command will read the specified file and add line numbers to each line. The output will display the line numbers along with the content of each line, typically arranged in a tabular form.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the nl tool