uniq(1) on Solnix vs Linux and the BSDs

On Solnix, uniq is the illumos /usr/bin/uniq, which documents only -c, -d, -u, -f and -s plus the historic +m and -n forms. -i, -D, -w and the long options appear only for the ksh93 built-in, so scripts using GNU or BSD extras can break.

What Solnix runs

A default Solnix system runs the illumos uniq at /usr/bin/uniq; no other variants are shipped. The page also documents a ksh93 built-in uniq, used when ksh93 runs uniq without a path prefix and finds /bin/uniq or /usr/bin/uniq. Only the built-in's synopsis lists -i, -D, -w and long options.

Differences

Compared withTopicWhat differs
Linux, FreeBSD, OpenBSD-i (ignore case)The Solnix /usr/bin/uniq synopsis has no -i. Only the ksh93 built-in documents it. Linux, FreeBSD and OpenBSD document -i for the standalone command. A script that uses uniq -i may fail under a non-ksh93 shell on Solnix.
Source: Solnix uniq(1) SYNOPSIS (/usr/bin/uniq vs ksh93), OPTIONS ksh93 -i; Linux uniq(1) -i; FreeBSD uniq(1) -i; OpenBSD uniq(1) -i
NetBSD-i missingNetBSD uniq has no case-insensitive option (its synopsis is [-cdu] [-f fields] [-s chars]). Solnix has -i only in the ksh93 built-in.
Source: NetBSD uniq(1) SYNOPSIS; Solnix uniq(1) OPTIONS ksh93 -i
Linux-w check-chars-w N (compare no more than N characters) is documented by Linux and by the Solnix ksh93 built-in, not by the Solnix /usr/bin/uniq synopsis. FreeBSD, OpenBSD and NetBSD have no -w.
Source: Linux uniq(1) -w; Solnix uniq(1) ksh93 -w; FreeBSD/OpenBSD/NetBSD uniq(1) SYNOPSIS
Linux, FreeBSD-D (all repeated lines)Solnix /usr/bin/uniq does not document -D. The ksh93 built-in has -D[delimit] with none, prepend or separate, default none. FreeBSD and Linux have -D. OpenBSD and NetBSD do not.
Source: Solnix uniq(1) ksh93 -D; FreeBSD uniq(1) -D; Linux uniq(1) -D, --all-repeated; OpenBSD/NetBSD uniq(1) SYNOPSIS
Linux-z and --groupLinux uniq has -z (NUL-terminated lines) and --group[=METHOD]. The Solnix page documents neither option, and no BSD page does.
Source: Linux uniq(1) -z, --group; Solnix uniq(1) OPTIONS
all fourhistoric +m and -nSolnix documents +m (same as -s m) and -n (same as -f n) as normal options. FreeBSD, OpenBSD and NetBSD call them deprecated but still supported. The Linux page does not mention them.
Source: Solnix uniq(1) OPTIONS +m, -n; FreeBSD uniq(1) COMPATIBILITY; OpenBSD uniq(1) STANDARDS; NetBSD uniq(1) COMPATIBILITY
Linux, FreeBSDlong optionsThe Solnix /usr/bin/uniq has no long options. The ksh93 built-in has them, but its -u long name is --uniq, while Linux and FreeBSD use --unique. OpenBSD and NetBSD have none.
Source: Solnix uniq(1) ksh93 -u, --uniq; Linux uniq(1) -u, --unique; FreeBSD uniq(1) -u, --unique; OpenBSD/NetBSD uniq(1) SYNOPSIS
FreeBSD, OpenBSD, NetBSDcombining -c with -d or -uThe Solnix /usr/bin/uniq synopsis shows -c, -d and -u as alternatives: [-c | -d | -u]. OpenBSD says using -c with -d or -u is an extension. FreeBSD and NetBSD synopses allow the flags together.
Source: Solnix uniq(1) SYNOPSIS /usr/bin/uniq; OpenBSD uniq(1) STANDARDS; FreeBSD uniq(1) SYNOPSIS; NetBSD uniq(1) SYNOPSIS
FreeBSD, OpenBSD, NetBSD-c output formatFreeBSD, OpenBSD and NetBSD state that the count is followed by a single space. The Solnix page only says -c precedes each line with a count and does not give the spacing.
Source: Solnix uniq(1) -c; FreeBSD/OpenBSD/NetBSD uniq(1) -c
OpenBSD'-' as output fileOpenBSD treats '-' as standard input or standard output depending on its position. Solnix documents '-' only for input_file. The Solnix page says results are unspecified if output_file is the same file as input_file.
Source: OpenBSD uniq(1) DESCRIPTION; Solnix uniq(1) OPERANDS
all fourenvironment variablesSolnix lists LANG, LC_ALL, LC_CTYPE, LC_MESSAGES and NLSPATH. FreeBSD lists LANG, LC_ALL, LC_COLLATE and LC_CTYPE. OpenBSD lists only LC_CTYPE. The Linux and NetBSD pages list none.
Source: Solnix uniq(1) ENVIRONMENT VARIABLES; FreeBSD uniq(1) ENVIRONMENT; OpenBSD uniq(1) ENVIRONMENT

Standards

  • POSIX: uniq is a POSIX.1-2024 utility.
  • Solnix: ATTRIBUTES for /usr/bin/uniq: Interface Stability Committed; Standard: see standards(7).
  • FreeBSD: The uniq utility conforms to IEEE Std 1003.1-2001 (“POSIX.1”) as amended by Cor. 1-2002.
  • OpenBSD: Compliant with IEEE Std 1003.1-2008 (“POSIX.1”). The -i option and the use of -c with -d or -u are extensions.
  • NetBSD: Expected to be IEEE Std 1003.2 (“POSIX.2”) compatible.

Writing portable scripts

  • Stick to -c, -d, -u, -f and -s. Avoid -i, -D, -w, -z and long options, which Solnix /usr/bin/uniq and the BSDs do not all provide.
  • Use -f N and -s N instead of the historic -N and +N forms. The BSD pages call those deprecated.
  • uniq only compares adjacent lines on every system, so sort the input first.

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.