link(8) on Solnix vs Linux and the BSDs

On Solnix, link is the illumos /usr/sbin/link, which calls link(2) directly with two operands and no options, and is documented in the same page as unlink. The most important difference is that /usr/xpg4/bin/link hard-links the target of a symbolic link, while /usr/sbin/link behaves differently on this point.

What Solnix runs

A default Solnix system runs the illumos /usr/sbin/link, and /usr/sbin/unlink is documented in the same page. /usr/xpg4/bin/link is also shipped with the same synopsis. If existing-file is a symbolic link, the xpg4 version creates new-file as a hard link to the file the symlink references, not to the symlink itself. The page does not say what /usr/sbin/link does in that case. Only super-users can use link and unlink on directories.

Differences

Compared withTopicWhat differs
all foursymlink operand handlingSolnix /usr/xpg4/bin/link hard-links the file a symbolic link refers to, not the symlink. The Solnix page does not state the behaviour of /usr/sbin/link. FreeBSD link takes no options, and the page documents -L (the ln default) and -P only for ln.
Source: Solnix link(8) DESCRIPTION (/usr/xpg4/bin/link); FreeBSD link(1) -L, -P and last paragraph of DESCRIPTION
FreeBSDlink is a mode of lnOn FreeBSD, link is documented in the ln(1) page, with the synopsis 'link source_file target_file'. Called as link, it needs exactly two arguments, neither a directory, and takes no options. On Solnix, link has its own page.
Source: FreeBSD link(1) NAME, SYNOPSIS, DESCRIPTION (last paragraph); Solnix link(8) SYNOPSIS
Linux, NetBSDsame simple modelLinux link(1) and NetBSD link(8) each take two file operands and call link(2). Linux accepts only --help and --version. NetBSD documents no options. Solnix link behaves the same way for the basic call, but has no --help or --version.
Source: Linux link(1) SYNOPSIS, DESCRIPTION; NetBSD link(8) SYNOPSIS, DESCRIPTION; Solnix link(8) SYNOPSIS
Linux, FreeBSD, NetBSDunlink in the same pageSolnix documents /usr/sbin/unlink file in the link page. The Linux, FreeBSD and NetBSD link pages in the bundle do not document an unlink command. The NetBSD SEE ALSO references unlink(8).
Source: Solnix link(8) SYNOPSIS, DESCRIPTION; NetBSD link(8) SEE ALSO; Linux link(1); FreeBSD link(1)
Linux, FreeBSD, NetBSDdirectories and error checkingSolnix says link and unlink call link(2) and unlink(2) directly with no error checking, and only super-users may use them on directories. The Linux, FreeBSD and NetBSD pages do not make this statement. FreeBSD says ln cannot hardlink directories.
Source: Solnix link(8) DESCRIPTION; FreeBSD link(1) DESCRIPTION; Linux link(1); NetBSD link(8)
NetBSDexit statusNetBSD link documents exit 0 on success and >0 on error. The Solnix page has no EXIT STATUS section, so its exit codes are not documented.
Source: NetBSD link(8) EXIT STATUS; Solnix link(8)
Linux, FreeBSD, NetBSDenvironment variablesSolnix link honours LANG, LC_ALL, LC_CTYPE, LC_MESSAGES and NLSPATH. The Linux, FreeBSD and NetBSD pages in the bundle list no environment variables for link.
Source: Solnix link(8) ENVIRONMENT VARIABLES; Linux link(1); FreeBSD link(1); NetBSD link(8)
OpenBSDno OpenBSD counterpartThe bundle includes no OpenBSD page for link, so no OpenBSD behaviour is stated here.
Source: Bundle header (counterparts: linux, freebsd, netbsd)

Standards

  • POSIX: link is a POSIX.1-2024 utility.
  • Solnix: Interface Stability for /usr/xpg4/bin/link: Standard.
  • FreeBSD: The simplified link command conforms to Version 2 of the Single UNIX Specification (“SUSv2”). The ln utility conforms to IEEE Std 1003.2-1992 (“POSIX.2”).
  • NetBSD: The link utility conforms to X/Open Commands and Utilities Issue 5 (“XCU5”).

Writing portable scripts

  • Use link only as 'link existing new' with two plain file operands and no options. This works on every system in the bundle.
  • Do not rely on link when the source may be a symbolic link: the Solnix page documents symlink handling only for /usr/xpg4/bin/link. Use ln with an explicit -L or -P where the system supports them.

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.