Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, February 10, 2021
 
 

logname(1)

Name

logname - return user's login name

Synopsis

/usr/bin/logname

Description

logname writes the user's login name to standard output. The login name is the string that is returned by the getlogin(3C) function. If getlogin() does not return successfully, the name corresponding to the real user ID of the calling process is used instead.

Environment Variables

See environ(7) for descriptions of the following environment variables that affect the execution of logname: LANG, LC_ALL , LC_CTYPE, LC_MESSAGES, and NLSPATH.

Exit Status

The following error values are returned:

0

Successful completion.

>0

An error occurred.

Files

/etc/profile

Environment for user at login time

/var/adm/utmpx

User and accounting information

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/core-os
Interface Stability
Committed
Standard

See Also

env(1), login(1), getlogin(3C), utmpx(5), attributes(7), environ(7), standards(7)