nl(1) on Solnix vs Linux and the BSDs
On Solnix, nl is the illumos nl at /usr/bin/nl, with a stricter /usr/xpg4/bin/nl also shipped. The defaults match the BSDs and GNU nl. The differences that bite are in option parsing: /usr/bin/nl lets option arguments be omitted, it accepts only one file, and there are no long options.
The manual pages
- Solnix: nl(1) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: nl(1) coreutils-full-9.11
- FreeBSD: nl(1) 15.1-RELEASE
- OpenBSD: nl(1) 8.0
- NetBSD: nl(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
nl
What Solnix runs
A default Solnix system runs the illumos /usr/bin/nl. /usr/xpg4/bin/nl is also shipped, and its ATTRIBUTES list Interface Stability as Standard. The page says /usr/xpg4/bin/nl options require option arguments, while /usr/bin/nl options may have them. If /usr/bin/nl is given an option with no argument, it uses that option's default.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| all four | optional option arguments | Solnix /usr/bin/nl allows -b, -d, -f, -h, -i, -l, -n, -s, -w and -v with no argument, which means the default for that option. /usr/xpg4/bin/nl requires the arguments. The Linux and BSD synopses show every option with a required argument.Source: Solnix nl(1) SYNOPSIS and OPTIONS; Linux nl(1) SYNOPSIS; FreeBSD/OpenBSD/NetBSD nl(1) SYNOPSIS |
| Linux | number of input files | Solnix nl names at most one file ("Only one file may be named"). GNU nl takes [FILE]... and writes each FILE to standard output. A Linux command line with several files will not work on Solnix. Source: Solnix nl(1) OPTIONS, OPERANDS; Linux nl(1) SYNOPSIS, DESCRIPTION |
| all four | - as standard input | FreeBSD, OpenBSD, NetBSD and Linux nl read standard input when the file is - or absent. The Solnix page says only that standard input is read when no file is named. It does not mention -. Source: Solnix nl(1) DESCRIPTION; FreeBSD/OpenBSD/NetBSD nl(1) DESCRIPTION; Linux nl(1) DESCRIPTION |
| Linux | long options | GNU nl has long options (--body-numbering, --number-format, --starting-line-number and others), plus --help and --version. The Solnix page documents only the single-letter options.Source: Linux nl(1) DESCRIPTION; Solnix nl(1) SYNOPSIS |
| Linux | -d section delimiter | GNU nl accepts more than two delimiter characters, and -d '' turns off section matching. Solnix and the BSDs describe a two-character delimiter, and the BSDs say at most two characters may be given. On Solnix, put no space between -d and its characters.Source: Linux nl(1) DESCRIPTION (CC); Solnix nl(1) -ddelim; FreeBSD/OpenBSD/NetBSD nl(1) -d |
| FreeBSD, OpenBSD, NetBSD | -d argument spacing | The BSD synopses write -d delim with a space. The Solnix page says no space should appear between -d and the delimiter characters. It allows a space for other options only under /usr/xpg4/bin/nl.Source: Solnix nl(1) -ddelim, OPTIONS; FreeBSD/OpenBSD/NetBSD nl(1) SYNOPSIS, -d |
| FreeBSD, OpenBSD, NetBSD | -w when the number is too wide | The BSD pages say that if the width is too small, the line number is truncated to its least significant digits. The Solnix page does not say what happens. Source: FreeBSD/OpenBSD/NetBSD nl(1) -w; Solnix nl(1) -wwidth |
| OpenBSD | environment variables | Solnix lists LANG, LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES and NLSPATH. FreeBSD lists LANG, LC_ALL, LC_CTYPE and LC_COLLATE. OpenBSD documents only LC_CTYPE, which decides what counts as a character for -d. The NetBSD and Linux pages list none.Source: Solnix nl(1) ENVIRONMENT VARIABLES; FreeBSD nl(1) ENVIRONMENT; OpenBSD nl(1) ENVIRONMENT |
| FreeBSD | line length limit | FreeBSD documents a limit of LINE_MAX (2048) bytes per input line. The Solnix page documents no such limit. Source: FreeBSD nl(1) BUGS; Solnix nl(1) |
| all four | defaults | The defaults agree on all systems: -bt, -fn, -hn, -i1, -l1, -n rn, tab separator, -v1, -w6, and \: as the delimiter. A script that relies only on the defaults behaves the same.Source: Solnix nl(1) OPTIONS; Linux nl(1) DESCRIPTION (default options); FreeBSD/OpenBSD/NetBSD nl(1) OPTIONS |
Standards
- POSIX: nl is a POSIX.1-2024 utility.
- Solnix: ATTRIBUTES for
/usr/xpg4/bin/nl: Interface Stability is Standard. - FreeBSD: The nl utility conforms to IEEE Std 1003.1-2001 (“POSIX.1”).
- OpenBSD: The nl utility is compliant with the X/Open System Interfaces option of the IEEE Std 1003.1-2008 (“POSIX.1”) specification.
- NetBSD: The nl utility is compliant with the X/Open Portability Guide Issue 4, Version 2 (“XPG4.2”) specification.
Writing portable scripts
- Always give every option an argument (for example
-ba,-nrz,-w6) and name at most one file. This is valid for/usr/bin/nl,/usr/xpg4/bin/nl, GNU nl and the BSDs. - Use only single-letter options and put no space after
-d. Avoid GNU long options and multi-character-ddelimiters.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.