uname — Display the name of the current operating system

Format

uname [–aImnrsv]

Note: Option –I is an uppercase i, not a lowercase L.

Description

The uname command lets shell scripts and other programs determine configuration information about the machine upon which the shell is running.

Options

The following options select the information to be displayed:
–a
All fields (equivalent to –mnrsv).
–I
The IBM® current product name information. This option affects the value of the system name, release, and version fields. This option might affect the output of the –a, –r, –s and –v options. When –I is not specified (the default), the OS/390® product name information is returned.
–m
The processor or machine type.
–n
The node name of this particular machine. The node name is set by the SYSNAME sysparm (specified at IPL), and it usually differentiates machines running at a single location.
–r
The release (minor version) number of the operating system.
–s
The name of the operating system. This is the default output, when no options are given.
–v
The version (major version) number of the operating system.
uname displays the selected information in the following order:
<system name> <nodename> <release> <version> <machine>

Examples

  1. The following shell command changes the prompt to identify the node name of the system:
    export PS1="`uname –n ` $ "
  2. The following indicates what is returned when you specify the –I option and when you do not (not specifying –I is the default):
    If running on z/OS 1.2:
    issuing >uname -rsv gives you
    OS/390 12.00 03
    
    issuing >uname -rsvI gives you
    z/OS 02.00 01

Localization

uname uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_CTYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Exit values

0
Successful completion
1
Failure due to inability to find the desired information
2
Failure due to an incorrect command-line option

Portability

POSIX.2, X/Open Portability Guide, UNIX System V.

Related information

sh