fold(1) on Solnix vs Linux and the BSDs

On Solnix, fold is the illumos fold at /usr/bin/fold. It takes -b, -s and -w like the BSDs and Linux, and also accepts the older -width form. It has no -c and no GNU long options, and its page spells out how backspace, carriage return and tab are counted.

What Solnix runs

A default Solnix system runs the illumos fold at /usr/bin/fold. /usr/ucb/fold is also shipped, but the bundle does not describe it. The page is published in pkgs.solnix.illumos-world-man.

Differences

Compared withTopicWhat differs
Linux-c optionLinux fold has -c/--characters to count characters rather than columns. The Solnix synopsis lists only -b, -s and -w, so fold -c fails on Solnix.
Source: Linux fold(1) -c, --characters; Solnix fold(1) SYNOPSIS
Linuxlong optionsLinux fold accepts --bytes, --spaces, --width=WIDTH, --help and --version. The Solnix page documents none of these long options.
Source: Linux fold(1) OPTIONS; Solnix fold(1) SYNOPSIS and OPTIONS
all four-width formSolnix accepts the width as -w width or as -width, for example fold -40. The Linux, FreeBSD, OpenBSD and NetBSD pages document only -w width.
Source: Solnix fold(1) SYNOPSIS, -w width|-width; Linux, FreeBSD, OpenBSD and NetBSD fold(1) SYNOPSIS
all fourinvalid widthSolnix fold returns an error if width is not a positive decimal number. It also says behaviour is undefined if width is less than the columns one character occupies. The other four pages do not say.
Source: Solnix fold(1) -w and DESCRIPTION; Linux, FreeBSD, OpenBSD and NetBSD fold(1) -w
FreeBSD, NetBSDtab handlingSolnix moves a tab to the next tab stop, at every 8th column, and documents backspace and carriage return handling. FreeBSD and NetBSD only advise a width that is a multiple of 8, or running expand(1) first.
Source: Solnix fold(1) DESCRIPTION (TAB, BACKSPACE, CARRIAGE-RETURN); FreeBSD fold(1) -w; NetBSD fold(1) BUGS
Linuxspecial characters undocumentedThe Linux page does not say how backspace, carriage return or tab affect the column count. Solnix documents all three, and ignores them under -b.
Source: Linux fold(1) DESCRIPTION; Solnix fold(1) DESCRIPTION
Linuxreading standard inputLinux documents that a FILE of - reads standard input. The Solnix page says standard input is used only when no file operand is given, and does not mention -.
Source: Linux fold(1) DESCRIPTION; Solnix fold(1) OPERANDS
FreeBSD, OpenBSD, NetBSDenvironment variablesSolnix lists LANG, LC_ALL, LC_CTYPE, LC_MESSAGES and NLSPATH. FreeBSD lists LANG, LC_ALL and LC_CTYPE. OpenBSD and NetBSD list only LC_CTYPE. The Linux page lists none.
Source: Solnix fold(1) ENVIRONMENT VARIABLES; FreeBSD fold(1) ENVIRONMENT; OpenBSD fold(1) ENVIRONMENT; NetBSD fold(1) ENVIRONMENT
OpenBSDC locale widthOpenBSD says that with LC_CTYPE unset, or set to C or POSIX, each byte except backspace, tab, newline and carriage return counts as width 1. The Solnix page gives no such rule.
Source: OpenBSD fold(1) ENVIRONMENT LC_CTYPE; Solnix fold(1) ENVIRONMENT VARIABLES
OpenBSDbackspace bugOpenBSD documents that POSIX backspace semantics mishandle backspace-encoded double-width characters and break lines early. The Solnix page only says fold may not work correctly if underlining is present.
Source: OpenBSD fold(1) BUGS; Solnix fold(1) NOTES

Standards

Writing portable scripts

  • Use only -b, -s and -w width, written as -w 40, not -40 or --width. The -c flag exists only on Linux.
  • Tab stops are documented only on Solnix and OpenBSD. Pick a width that is a multiple of 8, or run expand(1) first, if the input has tabs.

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.