Skip to Content
gnux

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 exit

Examples

unamex
unamex -a
unamex -m
unamex -r
unamex -o
unamex -sr
unamex -n

Branch a script on the operating system

case "$(unamex -s)" in Linux) echox linux ;; Darwin) echox macos ;; esac

Pick 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.log
gnux shell -c 'unamex -srm'

Options

Each option has a page of its own, with its usage and examples.

Exit status

StatusMeaning
0success: every operand was processed
1failure: 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

See also

On this page