Scroll to navigation

get_machine(1) User Manuals get_machine(1)


get_machine - identify running hardware architecture


get_machine [ --exact --override OVERRIDE --os ]


get_machine exists to make simple shell scripts that need to know that hardware architecture it is assuming or what host operating system is being used.

At its core is figure out the general hardware architecture and return it as quickly as possible. Although it is sometimes useful to return something different; which is why --override exists and thus what ever is supplied by with it is returned. Scripts that wish to expose that can leverage the environment variable GET_MACHINE_FLAGS to allow efficient overriding in their scripts. Or if they wish to only override what Operating system is running the environment variable GET_MACHINE_OS_FLAGS should be used.
If one wishes for something more exact than x86 or amd64, the option --exact will return more specific values like i686-pae.
Should one desire to know the host operating system: --os
A word of warning; --override always will take top precedence and can return anything you desire.


Typically, get_machine will be in scripts used in bootstrapping
# get_machine
# get_machine --override "I am the very model of a modern major general"
# get_machine ${GET_MACHINE_FLAGS}
# get_machine ${GET_MACHINE_OS_FLAGS} --os


get_machine is compatible with all Turing complete machines; even the ones that try to be Turing complete -1


Jeremiah Orians <>


Copyright 2016-2021 Jeremiah Orians <>
License GPLv3+.


M1(1), hex2(1), blood-elf(1), kaem(1), syscalls(2)

JULY 2019 Linux