1LOGNAME(1P)                POSIX Programmer's Manual               LOGNAME(1P)
2
3
4

PROLOG

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

NAME

12       logname — return the user's login name
13

SYNOPSIS

15       logname
16

DESCRIPTION

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

OPTIONS

26       None.
27

OPERANDS

29       None.
30

STDIN

32       Not used.
33

INPUT FILES

35       None.
36

ENVIRONMENT VARIABLES

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

ASYNCHRONOUS EVENTS

63       Default.
64

STDOUT

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

STDERR

73       The standard error shall be used only for diagnostic messages.
74

OUTPUT FILES

76       None.
77

EXTENDED DESCRIPTION

79       None.
80

EXIT STATUS

82       The following exit values shall be returned:
83
84        0    Successful completion.
85
86       >0    An error occurred.
87

CONSEQUENCES OF ERRORS

89       Default.
90
91       The following sections are informative.
92

APPLICATION USAGE

94       The logname utility explicitly ignores the LOGNAME environment variable
95       because environment changes could produce erroneous results.
96

EXAMPLES

98       None.
99

RATIONALE

101       The passwd file is not listed as required  because  the  implementation
102       may have other means of mapping login names.
103

FUTURE DIRECTIONS

105       None.
106

SEE ALSO

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)
Impressum