1LOGNAME(1P) POSIX Programmer's Manual LOGNAME(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 logname — return the user's login name
13
15 logname
16
18 The logname utility shall write the user's login name to standard out‐
19 put. The login name shall be the string that would be returned by the
20 getlogin() function defined in the System Interfaces volume of
21 POSIX.1‐2017. Under the conditions where the getlogin() function would
22 fail, the logname utility shall write a diagnostic message to standard
23 error and exit with a non-zero exit status.
24
26 None.
27
29 None.
30
32 Not used.
33
35 None.
36
38 The following environment variables shall affect the execution of log‐
39 name:
40
41 LANG Provide a default value for the internationalization vari‐
42 ables that are unset or null. (See the Base Definitions vol‐
43 ume of POSIX.1‐2017, Section 8.2, Internationalization Vari‐
44 ables for the precedence of internationalization variables
45 used to determine the values of locale categories.)
46
47 LC_ALL If set to a non-empty string value, override the values of
48 all the other internationalization variables.
49
50 LC_CTYPE Determine the locale for the interpretation of sequences of
51 bytes of text data as characters (for example, single-byte as
52 opposed to multi-byte characters in arguments).
53
54 LC_MESSAGES
55 Determine the locale that should be used to affect the format
56 and contents of diagnostic messages written to standard
57 error.
58
59 NLSPATH Determine the location of message catalogs for the processing
60 of LC_MESSAGES.
61
63 Default.
64
66 The logname utility output shall be a single line consisting of the
67 user's login name:
68
69
70 "%s\n", <login name>
71
73 The standard error shall be used only for diagnostic messages.
74
76 None.
77
79 None.
80
82 The following exit values shall be returned:
83
84 0 Successful completion.
85
86 >0 An error occurred.
87
89 Default.
90
91 The following sections are informative.
92
94 The logname utility explicitly ignores the LOGNAME environment variable
95 because environment changes could produce erroneous results.
96
98 None.
99
101 The passwd file is not listed as required because the implementation
102 may have other means of mapping login names.
103
105 None.
106
108 id, who
109
110 The Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment
111 Variables
112
113 The System Interfaces volume of POSIX.1‐2017, getlogin()
114
116 Portions of this text are reprinted and reproduced in electronic form
117 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
118 table Operating System Interface (POSIX), The Open Group Base Specifi‐
119 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
120 Electrical and Electronics Engineers, Inc and The Open Group. In the
121 event of any discrepancy between this version and the original IEEE and
122 The Open Group Standard, the original IEEE and The Open Group Standard
123 is the referee document. The original Standard can be obtained online
124 at http://www.opengroup.org/unix/online.html .
125
126 Any typographical or formatting errors that appear in this page are
127 most likely to have been introduced during the conversion of the source
128 files to man page format. To report such errors, see https://www.ker‐
129 nel.org/doc/man-pages/reporting_bugs.html .
130
131
132
133IEEE/The Open Group 2017 LOGNAME(1P)