The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group


uname - return system name


uname [snrvma]


By default, the uname utility will write the operating system name to standard output. When options are specified, symbols representing one or more system characteristics will be written to the standard output. The format and contents of the symbols are implementation-dependent. On systems conforming to the XSH specification, the symbols written will be those supported by the XSH specification uname() function.


The uname utility supports the XBD specification, Utility Syntax Guidelines  .

The following options are supported:

Behave as though all of the options -mnrsv were specified.
Write the name of the hardware type on which the system is running to standard output.
Write the name of this node within an implementation-dependent communications network.
Write the current release level of the operating system implementation.
Write the name of the implementation of the operating system.
Write the current version level of this release of the operating system implementation.

If no options are specified, the uname utility will write the operating system name, as if the -s option had been specified.




Not used.




The following environment variables affect the execution of uname:
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
If set to a non-empty string value, override the values of all the other internationalisation variables.
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
Determine the location of message catalogues for the processing of LC_MESSAGES .




By default, the output will be a single line of the following form:

"%s\n", <sysname>

If the -a option is specified, the output will be a single line of the following form:

"%s %s %s %s %s\n", <sysname>,

Additional implementation-dependent symbols may be written; all such symbols will be written at the end of the line of output before the newline character.

If options are specified to select different combinations of the symbols, only those symbols will be written, in the order shown above for the -a option. If a symbol is not selected for writing, its corresponding trailing blank characters also will not be written.


Used only for diagnostic messages.






The following exit values are returned:
The requested information was successfully written.
An error occurred.




Note that any of the symbols could include embedded space characters, which may affect parsing algorithms if multiple options are selected for output.

The node name is typically a name that the system uses to identify itself for intersystem communication addressing.


The following command:

uname -sr

writes the operating system name and release level, separated by one or more blank characters.




The XSH specification description of uname().

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]