Forrest logo
back to the nl tool

nl:tldr:9e6ce

nl: Number non-blank lines in a file.
$ nl ${filename}
try on your machine

The nl command is a command-line utility available in Unix-like operating systems, used to number lines in a file or input stream.

The syntax of the command you provided is:

nl ${filename}

${filename} is a placeholder for the actual name of a file, which you need to replace with an actual file name.

When you execute this command, it will take the contents of the specified file (${filename}), add line numbers to each line, and print the result to the terminal.

For example, if you have a file named "example.txt" with the following contents:

This is line 1.
This is line 2.
This is line 3.

And you execute the command nl example.txt, the output would be:

     1  This is line 1.
     2  This is line 2.
     3  This is line 3.

Each line is prefixed with the line number and a tab character (by default) to format the output.

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