unamex
Print system information.
Mirrors GNU uname. Run it as unamex, or as gnux unamex.
Synopsis
unamex [OPTION]...GNU reference
Description
unamex prints information about the machine and operating system. With no option it prints the kernel name, as -s does. The selected fields are printed on one line, separated by spaces, in a fixed order whatever the order of the options: kernel name (-s), network node host name (-n), kernel release (-r), kernel version (-v), machine hardware name (-m), processor type (-p), hardware platform (-i) and operating system (-o). -a prints them all, leaving out -p and -i when they are unknown, as GNU does. The values come from uname(2) on Linux, sysctl on macOS and FreeBSD, and the registry on Windows, so unamex prints the same fields on every platform: on Windows the kernel name is 'Windows_NT' and the operating system 'MS/Windows'; in the browser playground the fields describe the WebAssembly runtime.
gnux's terminal view (BR-13), on a terminal (--pretty=auto, the default, or GNUX_PRETTY), the fields are a panel titled with the host's name, one labeled line each, every field when none is selected. $(unamex -s) is a pipe, not a terminal, so a script still gets GNU's one line. --theme=NAME picks its colors.
Permissions
Needs no permissions.
Use cases
- Branching a portable script on the operating system or architecture.
- Recording the platform in bug reports and build logs.
- Picking the right download for the machine's architecture with
-m. - Checking the kernel release before relying on a kernel feature.
- Getting the same answer on Linux, macOS, FreeBSD and Windows.
Flags
-a, --all print all information, in the following order, except omit -p and -i if unknown
-i, --hardware-platform print the hardware platform (non-portable)
--help display this help and exit
-s, --kernel-name print the kernel name
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-n, --nodename print the network node hostname
-o, --operating-system print the operating system
--pretty WHEN[="always"] the gnux terminal view WHEN: 'always' (the default when WHEN is omitted), 'auto' (the default: on a terminal only), or 'never'; GNUX_PRETTY sets the default
-p, --processor print the processor type (non-portable)
--theme NAME color the view with the built-in theme NAME (gnux theme picks and saves one); GNUX_THEME sets the default
--version output version information and exitExamples
Print the kernel name
unamexPrint everything
unamex -aPrint the machine architecture
unamex -mPrint the kernel release
unamex -rPrint the operating system
unamex -oPrint the kernel name and release
unamex -srPrint the host name
unamex -nBranch a script on the operating system
case "$(unamex -s)" in Linux) echox linux ;; Darwin) echox macos ;; esacPick a download for this machine
curl -LO "https://example.com/tool-$(unamex -s)-$(unamex -m).tar.gz"Record the platform in a log
unamex -a >> build.logPrint system information in the portable gnux shell
gnux shell -c 'unamex -srm'Options
Each option has a page of its own, with its usage and examples.
- -a, --all: Print all information, in the following order, except omit
-pand-iif unknown. - -i, --hardware-platform: Print the hardware platform (non-portable).
- -s, --kernel-name: Print the kernel name.
- -r, --kernel-release: Print the kernel release.
- -v, --kernel-version: Print the kernel version.
- -m, --machine: Print the machine hardware name.
- -n, --nodename: Print the network node
hostname. - -o, --operating-system: Print the operating system.
- --pretty: The
gnuxterminal view WHEN: 'always' (the default when WHEN is omitted), 'auto' (the default: on a terminal only), or 'never'; GNUX_PRETTY sets the default. - -p, --processor: Print the processor type (non-portable).
- --theme: Color the view with the built-in theme NAME (
gnuxtheme picks and saves one); GNUX_THEME sets the default.
Exit status
| Status | Meaning |
|---|---|
| 0 | success: every operand was processed |
| 1 | failure: an operand could not be processed (diagnosed on standard error), or a command-line mistake |
Help in the terminal
unamex --help # options, first examples, exit status
gnux help unamex # this page: the full manual
gnux help unamex --OPTION # one option in depth, with its examples