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.
The manual pages
- Solnix: fold(1) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: fold(1) coreutils-full-9.11
- FreeBSD: fold(1) 15.1-RELEASE
- OpenBSD: fold(1) 8.0
- NetBSD: fold(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
fold
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 with | Topic | What differs |
|---|---|---|
| Linux | -c option | Linux 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 |
| Linux | long options | Linux 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 form | Solnix 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 four | invalid width | Solnix 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, NetBSD | tab handling | Solnix 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 |
| Linux | special characters undocumented | The 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 |
| Linux | reading standard input | Linux 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, NetBSD | environment variables | Solnix 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 |
| OpenBSD | C locale width | OpenBSD 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 |
| OpenBSD | backspace bug | OpenBSD 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
- POSIX: fold is a POSIX.1-2024 utility.
- Solnix: Interface Stability: Standard. CSI: enabled.
- FreeBSD: The fold utility conforms to IEEE Std 1003.1-2001 (“POSIX.1”).
- OpenBSD: The fold utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification.
- NetBSD: The fold utility conforms to IEEE Std 1003.1-2008 (“POSIX.1”).
- Linux: The Linux page in the bundle has no STANDARDS section.
Writing portable scripts
- Use only
-b,-sand-wwidth, written as-w40, not-40or--width. The-cflag 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.