file(1b) on Solnix vs Linux and the BSDs

The page file(1b) documents /usr/ucb/file, the BSD-compatibility file. It is not the file on a default Solnix PATH, which is /usr/bin/file. The ucb variant has only -c, -f, -L and -m. It lacks -b, -i/--mime, -h and -s, which Linux, FreeBSD, NetBSD and OpenBSD scripts commonly use.

What Solnix runs

A default Solnix system runs the illumos file at /usr/bin/file. This page documents the variant /usr/ucb/file. /usr/xpg4/bin/file is also shipped. The bundle contains no text for /usr/bin/file or /usr/xpg4/bin/file, so this page cannot say how they differ from the ucb variant. Check file(1) for the one on PATH before relying on its options.

Differences

Compared withTopicWhat differs
all fourmissing -b brief modeSolnix /usr/ucb/file has no -b, so output always starts with the filename. Linux, FreeBSD, NetBSD and OpenBSD all document -b/--brief, which omits the filename.
Source: Solnix file(1b) SYNOPSIS and OPTIONS; Linux/FreeBSD/NetBSD file(1) -b, --brief; OpenBSD file(1) -b, --brief
all fourno MIME outputSolnix /usr/ucb/file has no -i or --mime option. Linux, FreeBSD and NetBSD document -i, --mime-type and --mime-encoding. OpenBSD documents -i, --mime and --mime-type, giving strings like text/plain.
Source: Solnix file(1b) OPTIONS; Linux/FreeBSD/NetBSD file(1) SYNOPSIS (-i, --mime-type, --mime-encoding); OpenBSD file(1) -i, --mime, --mime-type
all four-c meaningOn Solnix, -c checks the magic file for format errors, and no file type-checking is done while it is in effect. Linux, FreeBSD and NetBSD -c prints the parsed form of the magic file for debugging. OpenBSD -c prints a summary of the parsed magic file.
Source: Solnix file(1b) -c; Linux/FreeBSD/NetBSD file(1) -c, --checking-printout; OpenBSD file(1) -c
OpenBSDsymlink flags -L and -hSolnix -L tests the file a symbolic link references instead of the link. OpenBSD -L does the same, and OpenBSD -h (do not follow, the default) is not in the Solnix synopsis. The Solnix page states no default.
Source: Solnix file(1b) -L, SYNOPSIS; OpenBSD file(1) -L, -h
Linux, FreeBSD, NetBSD-h in the other synopsesLinux, FreeBSD and NetBSD list -h and --no-dereference in their synopsis or option set. Solnix /usr/ucb/file has no -h; only -L is documented for symbolic links.
Source: Linux/FreeBSD/NetBSD file(1) SYNOPSIS (-h) and option list; Solnix file(1b) SYNOPSIS
OpenBSD-f and -m missing on OpenBSDSolnix has -f ffile (read filenames from a file) and -m mfile (alternate magic file). OpenBSD's synopsis is [-bchiLsW] and has neither. Linux, FreeBSD and NetBSD have both: -f namefile and -m magicfiles.
Source: Solnix file(1b) -f, -m; OpenBSD file(1) SYNOPSIS; Linux/FreeBSD/NetBSD file(1) SYNOPSIS
Linux, FreeBSD, NetBSD-m takes a listSolnix -m takes one alternate magic file, mfile. Linux, FreeBSD and NetBSD name the argument magicfiles, in the plural; the bundle's text for them does not show how several files are given.
Source: Solnix file(1b) -m; Linux/FreeBSD/NetBSD file(1) SYNOPSIS (-m magicfiles)
all fourmagic file locationSolnix reads /etc/magic. OpenBSD also uses /etc/magic, and ~/.magic instead if it exists and file is not running as root. FreeBSD and NetBSD read /usr/share/misc/magic.mgc. Linux reads a magic.mgc under its package share/misc directory. These three prefer $HOME/.magic.mgc or $HOME/.magic.
Source: Solnix file(1b) DESCRIPTION; OpenBSD file(1) DESCRIPTION; FreeBSD/NetBSD file(1) DESCRIPTION; Linux file(1) DESCRIPTION
Linux, FreeBSD, NetBSDtext language detectionSolnix examines the first 512 bytes of ASCII text to guess its language. Linux, FreeBSD and NetBSD look for particular strings anywhere in the first few blocks of the file.
Source: Solnix file(1b) DESCRIPTION; Linux/FreeBSD/NetBSD file(1) DESCRIPTION (language tests)
Linux, FreeBSD, NetBSDfilesystem error handling, -ELinux, FreeBSD and NetBSD handle errors such as file not found as regular output and keep going, as they say POSIX mandates. -E makes them print an error and exit. Solnix /usr/ucb/file documents no -E.
Source: Linux/FreeBSD/NetBSD file(1) -E; Solnix file(1b) OPTIONS
OpenBSDstandard input and exit statusOpenBSD file reads standard input when the argument is a single dash, and documents exit 0 on success and >0 on error. The Solnix page documents neither a dash argument nor an exit status.
Source: OpenBSD file(1) DESCRIPTION, EXIT STATUS; Solnix file(1b) (no such section)
Linux, FreeBSD, NetBSDsame program familyThe Linux, FreeBSD and NetBSD pages share one synopsis and text. They document file versions 5.47, 5.46 and 5.45, with options such as -C, -e, -F, -P, -0, --extension and --apple that Solnix /usr/ucb/file lacks.
Source: Linux file(1) DESCRIPTION (5.47); FreeBSD file(1) DESCRIPTION (5.46); NetBSD file(1) DESCRIPTION (5.45); Solnix file(1b) SYNOPSIS

Standards

  • POSIX: file is a POSIX.1-2024 utility.
  • Solnix: The file(1b) page has no STANDARDS section and states no conformance. It refers to attributes(7) in SEE ALSO, but the bundle does not show an interface stability level.

Writing portable scripts

  • Do not use -b, -i or --mime in portable scripts. /usr/ucb/file lacks them. Strip the filename prefix yourself, for example by cutting at the first colon-space, and check the file on PATH first.
  • Limit scripts to -L and -f for a portable base. Use -m only where the target has it; OpenBSD file does not.

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.