-
-
Notifications
You must be signed in to change notification settings - Fork 1
Linux nl Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to nl on Linux, covering Arch Linux, CachyOS, and other distributions including line numbering, text numbering, and file line counting.
Basic usage:
# Number lines
nl file.txt
# Numbers all linesPipe input:
# Number from input
cat file.txt | nl
# Numbers piped inputNumber all:
# Number all lines
nl file.txt
# Numbers every lineStart from:
# Start from number
nl -v 10 file.txt
# -v = start value (starts from 10)Custom format:
# Custom format
nl -n ln file.txt
# -n = number format (ln = left, no zero padding)Format types:
# ln = left, no padding
nl -n ln file.txt
# rn = right, no padding
nl -n rn file.txt
# rz = right, zero padded
nl -n rz file.txtNumber only body:
# Number only body lines
nl -b a file.txt
# -b = body numbering (a = all lines)Skip blanks:
# Skip empty lines
nl -b t file.txt
# -b t = skip empty linesCheck installation:
# nl is part of coreutils
# Usually pre-installed
# Check nl
which nlThis guide covered nl usage, line numbering, and text numbering for Arch Linux, CachyOS, and other distributions.
- cat Guide - Display files
- head Guide - View file beginnings
- Text Processing - Text manipulation
-
nl Documentation:
man nl
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.