nl
FilesBeginner In simulator In real LinuxNumber the lines of files
Name: nl = number lines
You can practise it right away in the simulator, and use it in real Linux mode too.
Description
nl writes a file with line numbers added. Unlike cat -n it skips blank lines by default and lets you control the number format, width and start value.
Syntax
nl [OPTION]... [FILE]...Common options
| -b a | Number all lines, including blank ones |
| -w / --number-width NUM | Width of the line numbers |
| -s / --number-separator STRING | Put STRING between the number and the line (a tab by default) |
| -v / --starting-line-number NUM | Start numbering at NUM |
| -i / --line-increment NUM | Count up by NUM |
| -n / --number-format FORMAT | Number format: ln left, rn right, rz right with zeros |
Examples
$ nl notes.txt
Show a file with line numbers
Explain