logname(1) on Solnix vs Linux and the BSDs
On Solnix, logname is the illumos logname at /usr/bin/logname. It takes no options and prints the getlogin(3C) name, falling back to the name for the real user ID and then to the numeric ID. The BSD pages say it ignores LOGNAME and USER. The Solnix page does not mention those variables.
The manual pages
- Solnix: logname(1) from
pkgs.solnix.illumos-world-man· illumos.org - Linux: logname(1) coreutils-full-9.11
- FreeBSD: logname(1) 15.1-RELEASE
- OpenBSD: logname(1) 8.0
- NetBSD: logname(1) 11.0
- Standard: POSIX.1-2024 (IEEE Std 1003.1-2024),
logname
What Solnix runs
A default Solnix system runs the illumos logname at /usr/bin/logname. No other variants are shipped. The package is pkgs.solnix.illumos-world-man.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| FreeBSD, OpenBSD, NetBSD | fallback when getlogin fails | Solnix logname falls back to the name for the real user ID, and then prints the numeric user ID if no name is found. The FreeBSD, OpenBSD and NetBSD pages describe no fallback. They say only that it exits >0 on error. Source: Solnix logname(1) DESCRIPTION; FreeBSD/OpenBSD/NetBSD logname(1) DESCRIPTION and EXIT STATUS |
| FreeBSD, OpenBSD, NetBSD | LOGNAME and USER | The BSD pages say logname ignores LOGNAME and USER because the environment cannot be trusted. The Solnix page lists only LANG, LC_ALL, LC_CTYPE, LC_MESSAGES and NLSPATH as affecting logname, and does not mention LOGNAME or USER. Source: FreeBSD/OpenBSD/NetBSD logname(1) DESCRIPTION; Solnix logname(1) ENVIRONMENT VARIABLES |
| Linux | options | Linux (GNU coreutils) logname accepts --help and --version. The Solnix synopsis is plain logname with no options, and the page documents none.Source: Linux logname(1) SYNOPSIS, --help, --version; Solnix logname(1) SYNOPSIS |
| Linux | fallback and environment detail | The Linux page says only that it prints the user's login name. It does not document a fallback or environment variables. The manual does not say what Linux prints when the login name cannot be found. Source: Linux logname(1) DESCRIPTION; Solnix logname(1) DESCRIPTION |
| all four | exit status | Solnix documents 0 for success and >0 for an error, the same as FreeBSD, OpenBSD and NetBSD. The Linux page has no EXIT STATUS section. Source: Solnix logname(1) EXIT STATUS; FreeBSD/OpenBSD/NetBSD logname(1) EXIT STATUS; Linux logname(1) |
| FreeBSD, OpenBSD, NetBSD | output newline | The BSD pages say the name is followed by a newline. The Solnix page says it writes the login name to standard output and does not mention a trailing newline. Source: FreeBSD/OpenBSD/NetBSD logname(1) DESCRIPTION; Solnix logname(1) DESCRIPTION |
Standards
- POSIX: logname is a POSIX.1-2024 utility.
- Solnix: Interface Stability: Committed. The Standard attribute says "See standards(7)."
- FreeBSD: The logname utility is expected to conform to IEEE Std 1003.2 (“POSIX.2”).
- OpenBSD: The logname utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification.
- NetBSD: The logname utility conforms to IEEE Std 1003.2-1992 (“POSIX.2”).
Writing portable scripts
- Call logname with no arguments. Only the GNU version documents any options (
--help,--version). - Do not rely on LOGNAME or USER to find the login name. The BSD pages say logname ignores them, so the two can disagree.
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.