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
11
13 logname — return the user's login name
14
16 logname
17
19 The logname utility shall write the user's login name to standard out‐
20 put. The login name shall be the string that would be returned by the
21 getlogin() function defined in the System Interfaces volume of
22 POSIX.1‐2008. Under the conditions where the getlogin() function would
23 fail, the logname utility shall write a diagnostic message to standard
24 error and exit with a non-zero exit status.
25
27 None.
28
30 None.
31
33 Not used.
34
36 None.
37
39 The following environment variables shall affect the execution of log‐
40 name:
41
42 LANG Provide a default value for the internationalization vari‐
43 ables that are unset or null. (See the Base Definitions vol‐
44 ume of POSIX.1‐2008, Section 8.2, Internationalization Vari‐
45 ables for the precedence of internationalization variables
46 used to determine the values of locale categories.)
47
48 LC_ALL If set to a non-empty string value, override the values of
49 all the other internationalization variables.
50
51 LC_CTYPE Determine the locale for the interpretation of sequences of
52 bytes of text data as characters (for example, single-byte as
53 opposed to multi-byte characters in arguments).
54
55 LC_MESSAGES
56 Determine the locale that should be used to affect the format
57 and contents of diagnostic messages written to standard
58 error.
59
60 NLSPATH Determine the location of message catalogs for the processing
61 of LC_MESSAGES.
62
64 Default.
65
67 The logname utility output shall be a single line consisting of the
68 user's login name:
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‐2008, Chapter 8, Environment
111 Variables
112
113 The System Interfaces volume of POSIX.1‐2008, getlogin()
114
116 Portions of this text are reprinted and reproduced in electronic form
117 from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology
118 -- Portable Operating System Interface (POSIX), The Open Group Base
119 Specifications Issue 7, Copyright (C) 2013 by the Institute of Electri‐
120 cal and Electronics Engineers, Inc and The Open Group. (This is
121 POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the
122 event of any discrepancy between this version and the original IEEE and
123 The Open Group Standard, the original IEEE and The Open Group Standard
124 is the referee document. The original Standard can be obtained online
125 at http://www.unix.org/online.html .
126
127 Any typographical or formatting errors that appear in this page are
128 most likely to have been introduced during the conversion of the source
129 files to man page format. To report such errors, see https://www.ker‐
130 nel.org/doc/man-pages/reporting_bugs.html .
131
132
133
134IEEE/The Open Group 2013 LOGNAME(1P)