UNAME(1V)

NAME
uname - print the name of the system

SYNOPSIS
uname [ -amnrsv ]

DESCRIPTION
Uname prints name and version information about the current system. It may be used directly to find out details about the current system or within shell scripts to allow the script to behave appropriately on different systems.

The command uses the uname system call which fills in the information in a struct utsname. See the header file /usr/include/sys/utsname.h for more information about this structure.

OPTIONS

-a  Print all the information. The output format may vary from system to system.

The other options may be combined. Specifying them all is effectively equivalent to specifying -a (although there is no guarantee that the output format will be the same).

-m  Print information about the hardware type. The interpretation of this field is highly variable. On some systems it gives a very precise description of the hardware (for example a manufacturer model number) on others it just gives the manufacturer. This makes the information very difficult to use.

-n  Print the system node name. This is the information set using the hostname(1) command, it may be unset or meaningless on a non-networked system.

-r  Print the current release level. This should be a string identifying the release of the system given by -s.

-s  Print the operating system name. Together with the information given by -r and -v and, possibly -m, this should give a complete identification of the system, unfortunately this is not always the case.

-v  Print the version level. This is the version of the operating system release identified by -s and -r.

SEE ALSO
hostname(1), gethostname(2), sethostname(2).

NOTES

Only the node name can (normally) be changed within an individual machine. The other information is built in to the operating system kernel.

Any of the information printed may contain white space characters or consist of empty strings, thus when using the output within a shell script remember to include it within quotes. For example, to test whether the machine on which a shell script is being run is executing the “RISC iX” operating system:

    if [ "`uname -s`" = "RISC iX" ]; then ...

In the absence of any formal definition of the output of this command it is almost impossible to use it for anything other than specific tests. On some operating systems it is impossible to obtain sufficient information from uname to establish the precise execution environment, on such systems it will be necessary to execute further system specific tests.