1UNAME(1P) POSIX Programmer's Manual UNAME(1P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 uname — return system name
13
15 uname [-amnrsv]
16
18 By default, the uname utility shall write the operating system name to
19 standard output. When options are specified, symbols representing one
20 or more system characteristics shall be written to the standard output.
21 The format and contents of the symbols are implementation-defined. On
22 systems conforming to the System Interfaces volume of POSIX.1‐2017, the
23 symbols written shall be those supported by the uname() function as
24 defined in the System Interfaces volume of POSIX.1‐2017.
25
27 The uname utility shall conform to the Base Definitions volume of
28 POSIX.1‐2017, Section 12.2, Utility Syntax Guidelines.
29
30 The following options shall be supported:
31
32 -a Behave as though all of the options -mnrsv were specified.
33
34 -m Write the name of the hardware type on which the system is
35 running to standard output.
36
37 -n Write the name of this node within an implementation-defined
38 communications network.
39
40 -r Write the current release level of the operating system
41 implementation.
42
43 -s Write the name of the implementation of the operating system.
44
45 -v Write the current version level of this release of the oper‐
46 ating system implementation.
47
48 If no options are specified, the uname utility shall write the operat‐
49 ing system name, as if the -s option had been specified.
50
52 None.
53
55 Not used.
56
58 None.
59
61 The following environment variables shall affect the execution of
62 uname:
63
64 LANG Provide a default value for the internationalization vari‐
65 ables that are unset or null. (See the Base Definitions vol‐
66 ume of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
67 ables for the precedence of internationalization variables
68 used to determine the values of locale categories.)
69
70 LC_ALL If set to a non-empty string value, override the values of
71 all the other internationalization variables.
72
73 LC_CTYPE Determine the locale for the interpretation of sequences of
74 bytes of text data as characters (for example, single-byte as
75 opposed to multi-byte characters in arguments).
76
77 LC_MESSAGES
78 Determine the locale that should be used to affect the format
79 and contents of diagnostic messages written to standard
80 error.
81
82 NLSPATH Determine the location of message catalogs for the processing
83 of LC_MESSAGES.
84
86 Default.
87
89 By default, the output shall be a single line of the following form:
90
91
92 "%s\n", <sysname>
93
94 If the -a option is specified, the output shall be a single line of the
95 following form:
96
97
98 "%s %s %s %s %s\n", <sysname>, <nodename>, <release>,
99 <version>, <machine>
100
101 Additional implementation-defined symbols may be written; all such sym‐
102 bols shall be written at the end of the line of output before the <new‐
103 line>.
104
105 If options are specified to select different combinations of the sym‐
106 bols, only those symbols shall be written, in the order shown above for
107 the -a option. If a symbol is not selected for writing, its correspond‐
108 ing trailing <blank> characters also shall not be written.
109
111 The standard error shall be used only for diagnostic messages.
112
114 None.
115
117 None.
118
120 The following exit values shall be returned:
121
122 0 The requested information was successfully written.
123
124 >0 An error occurred.
125
127 Default.
128
129 The following sections are informative.
130
132 Note that any of the symbols could include embedded <space> characters,
133 which may affect parsing algorithms if multiple options are selected
134 for output.
135
136 The node name is typically a name that the system uses to identify
137 itself for inter-system communication addressing.
138
140 The following command:
141
142
143 uname -sr
144
145 writes the operating system name and release level, separated by one or
146 more <blank> characters.
147
149 It was suggested that this utility cannot be used portably since the
150 format of the symbols is implementation-defined. The POSIX.1 working
151 group could not achieve consensus on defining these formats in the
152 underlying uname() function, and there was no expectation that this
153 volume of POSIX.1‐2017 would be any more successful. Some applications
154 may still find this historical utility of value. For example, the sym‐
155 bols could be used for system log entries or for comparison with opera‐
156 tor or user input.
157
159 None.
160
162 The Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment
163 Variables, Section 12.2, Utility Syntax Guidelines
164
165 The System Interfaces volume of POSIX.1‐2017, uname()
166
168 Portions of this text are reprinted and reproduced in electronic form
169 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
170 table Operating System Interface (POSIX), The Open Group Base Specifi‐
171 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
172 Electrical and Electronics Engineers, Inc and The Open Group. In the
173 event of any discrepancy between this version and the original IEEE and
174 The Open Group Standard, the original IEEE and The Open Group Standard
175 is the referee document. The original Standard can be obtained online
176 at http://www.opengroup.org/unix/online.html .
177
178 Any typographical or formatting errors that appear in this page are
179 most likely to have been introduced during the conversion of the source
180 files to man page format. To report such errors, see https://www.ker‐
181 nel.org/doc/man-pages/reporting_bugs.html .
182
183
184
185IEEE/The Open Group 2017 UNAME(1P)