LOGNAME(1POSIX)

🌸 PROLOG 🌸

okay bestie, real talk before we even start: this page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the deets on Linux behavior), or honestly the interface might not even be implemented on Linux at all. πŸ’€


✨ NAME ✨

logname β€” returns the user's login name 🫢


πŸŽ€ SYNOPSIS πŸŽ€

logname

that's it. that's the whole thing. no flags, no arguments, she's a minimalist. πŸ’…


πŸ’– DESCRIPTION πŸ’–

so logname writes the user's login name to standard output. simple as that. the login name is the string that the getlogin() function would return β€” you know, the one defined in the System Interfaces volume of POSIX.1‐2017. ✨

and under the conditions where getlogin() would fail? yeah, that's when logname writes a diagnostic message to standard error and exits with a non-zero exit status. no cap, it will let you know something went wrong. 😭


🌈 OPTIONS 🌈

None. not a single one. she doesn't need them. πŸ‘‘


πŸ¦‹ OPERANDS πŸ¦‹

None. zero. nada. 🌸


⭐ STDIN ⭐

Not used. she's not reading anything from you, bestie. πŸ™ˆ


πŸ“ INPUT FILES πŸ“

None. πŸ’œ


🧚 ENVIRONMENT VARIABLES 🧚

the following environment variables shall affect the execution of logname:

  • LANG β€” provides a default value for the internationalization variables that are unset or null. (peep the Base Definitions volume of POSIX.1‐2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.) πŸ‘€
  • LC_ALL β€” if it's set to a non-empty string value, it overrides the values of all the other internationalization variables. she's the main character fr fr. πŸ‘‘
  • LC_CTYPE β€” determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).
  • LC_MESSAGES β€” determines the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
  • NLSPATH β€” determines the location of message catalogs for the processing of LC_MESSAGES.

πŸ”₯ ASYNCHRONOUS EVENTS πŸ”₯

Default. πŸ’…


🩷 STDOUT 🩷

the logname utility output shall be a single line consisting of the user's login name:

"%s\n", <login name>

one line, one name, iconic behavior honestly. ✨


πŸ’€ STDERR πŸ’€

standard error shall be used only for diagnostic messages. that's her one job. 🫢


🌸 OUTPUT FILES 🌸

None. πŸŽ€


🌟 EXTENDED DESCRIPTION 🌟

None. πŸ¦‹


πŸ’… EXIT STATUS πŸ’…

the following exit values shall be returned:

  • 0 β€” successful completion. slay! πŸŽ‰
  • >0 β€” an error occurred. 😭

πŸ™ˆ CONSEQUENCES OF ERRORS πŸ™ˆ

Default. 🫢

the following sections are informative. (aka, the fun bonus lore β€” read them, they're cute.)


πŸ’œ APPLICATION USAGE πŸ’œ

the logname utility explicitly ignores the LOGNAME environment variable because environment changes could produce erroneous results. so don't come at her with your LOGNAME, she's not listening. πŸ™…β™€οΈ


🌈 EXAMPLES 🌈

None. πŸ“


⭐ RATIONALE ⭐

the passwd file is not listed as required because the implementation may have other means of mapping login names. iykyk. πŸ’«


🧚 FUTURE DIRECTIONS 🧚

None. πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

id, who

the Base Definitions volume of POSIX.1‐2017, Chapter 8, Environment Variables

the System Interfaces volume of POSIX.1‐2017, getlogin()


portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .

any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .


that's the whole page bestie, you ate it up πŸ’– go run logname and find out who you are (digitally).

this has been your girl bringing you the IEEE/The Open Group 2017 edition of LOGNAME(1POSIX) β€” stay iconic, stay POSIX-compliant βœ¨πŸ¦‹πŸ’…

πŸ“¦ where this page comes from