logname(1) logname(1)
NAME
logname - display login name
SYNOPSIS
logname
DESCRIPTION
logname writes the user's login name to standard output. The login
name is the string that will be returned by the getlogin(3C) function.
If getlogin(3C) fails, a further attempt is made with the cuserid(3S)
function and the following message is displayed on standard error:
getlogin() call failed, trying cuserid().
Interaction with su
If you have logged in under a login name name, and then change to
another login name with su and enter logname under this new identity,
logname outputs the login name name in the same way as the who or
who am i command. id, on the other hand, outputs the current login
name according to su.
EXAMPLES
Example 1
You log in under the login name peter and then display this login
name:
$ logname
peter
Example 2
You now switch to the login name david with su and then display the
login name with logname, who am i and id:
$ su david
$ logname
peter
$ who am i
peter tty004 Mar 7 18:59
$ id
uid=1097(david) gid=20(user)
NOTES
utmp logging is made available with some X11 emulations. If the user
waives this option, logname cannot return a correct value (error mes-
sage: "getlogin() call failed,trying cuserid()").
Page 1 Reliant UNIX 5.44 Printed 11/98
logname(1) logname(1)
FILES
/etc/profile
File that is evaluated by each login shell. It is used for set-
ting a shell environment, depending on the contents of the LOG-
NAME (login name of the user) environment variable passed by
login. This file is created by the system administrator.
SEE ALSO
env(1), id(1), login(1), su(1), who(1), getlogin(3C), cuserid(3S),
environ(5).
Page 2 Reliant UNIX 5.44 Printed 11/98