logname — Return a user's login name

Format

logname

Description

logname displays the login name of the person who issued the command. It obtains the login name through the getlogin() function defined in the POSIX standard. The login name is displayed as all uppercase letters, regardless of how it was entered.

Environment variables

logname uses the following environment variable:
LOGNAME
Contains your user name.

Localization

logname uses the following localization environment variables:
  • LANG
  • LC_ALL
  • LC_TYPE
  • LC_MESSAGES
  • NLSPATH

See Localization for more information.

Exit values

0
Successful completion
1
logname could not determine the login name

Portability

POSIX.2, X/Open Portability Guide, UNIX System V.

Related information

env, id