zgrep(1) on Solnix vs Linux and the BSDs

zgrep is not in the Solnix base system; it is published in pkgs.solnix.gzip and is the same gzip-project script as on Linux. Its exit status (0 match, 1 no match, 2 trouble) and its list of unsupported grep options differ from NetBSD zgrep, which returns 1 only for missing arguments.

What Solnix runs

Not installed by default: add pkgs.solnix.gzip. The bundle shows no illumos zgrep on PATH and no other variants. The Solnix page text matches the Linux (gzip-1.14) page, apart from line wrapping.

Differences

Compared withTopicWhat differs
Linuxsame program as LinuxThe Solnix zgrep page and the Linux gzip-1.14 zgrep page have the same synopsis, GREP variable, exit status and BUGS text. Treat the two as the same program.
Source: Solnix zgrep(1) SYNOPSIS, DESCRIPTION, EXIT STATUS, BUGS; Linux zgrep(1) same sections
NetBSDexit statusSolnix zgrep exits 0 for a match, 1 for no matches and 2 on trouble. NetBSD zgrep returns 1 for missing arguments or a missing pattern and 0 otherwise, so a script cannot tell match from no match by exit status there.
Source: Solnix zgrep(1) EXIT STATUS; NetBSD zgrep(1) EXIT STATUS
FreeBSDexit status documentedThe FreeBSD zgrep page has no EXIT STATUS section. Solnix documents 0 for a match, 1 for no matches and 2 for trouble. The FreeBSD manual does not say what zgrep returns.
Source: Solnix zgrep(1) EXIT STATUS; FreeBSD zgrep(1) (no EXIT STATUS section)
all fourunsupported grep optionsSolnix zgrep does not support -R, -d, --exclude, --exclude-from, --exclude-dir, --include, -Z, -z and -r. Linux lists the same set. The FreeBSD and NetBSD pages list no such restrictions.
Source: Solnix zgrep(1) BUGS; Linux zgrep(1) BUGS; FreeBSD zgrep(1) DESCRIPTION; NetBSD zgrep(1) DESCRIPTION
FreeBSD, NetBSDchoosing the grep programSolnix and Linux zgrep use the program named in the GREP environment variable as grep. The FreeBSD and NetBSD pages mention no such variable. NetBSD instead provides zegrep and zfgrep, which call egrep(1) and fgrep(1).
Source: Solnix zgrep(1) DESCRIPTION (GREP); NetBSD zgrep(1) DESCRIPTION; FreeBSD zgrep(1) DESCRIPTION
FreeBSD, NetBSDzegrep and zfgrepFreeBSD and NetBSD pages document zegrep and zfgrep. The Solnix page documents only zgrep, so the bundle does not show whether the pkgs.solnix.gzip package installs them.
Source: FreeBSD zgrep(1) NAME, SYNOPSIS; NetBSD zgrep(1) NAME, SYNOPSIS; Solnix zgrep(1) NAME
FreeBSDother compression formatsFreeBSD's zgrep page also covers bzgrep, lzgrep, xzgrep and zstdgrep for bzip2, lzma, xz and zstd files. The Solnix page describes only gzip and compressed input and lists none of these commands.
Source: FreeBSD zgrep(1) NAME, SEE ALSO; Solnix zgrep(1) NAME, DESCRIPTION
NetBSDpattern syntaxNetBSD zgrep takes an optional -- before the pattern and files, and skips the pattern argument when -e is among the grep flags. Solnix has an optional -e before the pattern, and the page says nothing about --.
Source: NetBSD zgrep(1) SYNOPSIS, DESCRIPTION; Solnix zgrep(1) SYNOPSIS
NetBSDdecompression methodNetBSD zgrep decompresses with zcat(1) and feeds the result to grep. The Solnix page says it uncompresses files if necessary and does not name a decompressor.
Source: NetBSD zgrep(1) DESCRIPTION; Solnix zgrep(1) DESCRIPTION

Standards

  • POSIX: zgrep is not a POSIX.1-2024 utility.

Writing portable scripts

  • Do not use -r, -R, -d, -Z, -z, --include or --exclude* with zgrep. The Solnix and Linux pages list them as unsupported. Run find and pipe each file through zcat and grep instead.
  • Do not rely on zgrep exit status alone across systems. NetBSD returns 0 even when nothing matches, while Solnix and Linux return 1 for no match.

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.