This section describes commands that print user-related information: logins, groups, and so forth.
id
: Print real and effective uid and gid
id
prints information about the given user, or the process
running it if no user is specified.
Synopsis:
id [ option ]... [ username ]
By default, it prints the real user id, real group id, effective user id if different from the real user id, effective group id if different from the real group id, and supplemental group ids.
Each of these numeric values is preceded by an identifying string and followed by the corresponding user or group name in parentheses.
The options cause id
to print only part of the above information.
Also see section Common options.
-u
, -g
, or -G
.
-u
, -g
, or -G
.
logname
: Print current login name
logname
prints the calling user's name, as found in the file
`/etc/utmp', and exits with a status of 0. If there is no
`/etc/utmp' entry for the calling process, logname
prints
an error message and exits with a status of 1.
The only options are `--help' and `--version'. See section Common options.
whoami
: Print effective user id
whoami
prints the user name associated with the current
effective user id. It is equivalent to the command `id -un'.
The only options are `--help' and `--version'. See section Common options.
groups
: Print group names a user is in
groups
prints the names of the primary and any supplementary
groups that each given username, or the current process if none
are given, is in. If user names are given, the name of each user is
printed before the list of that user's groups.
Synopsis:
groups [ username ]...
The group lists are equivalent to the output of the command `id -Gn'.
The only options are `--help' and `--version'. See section Common options.
users
: Print login names of users currently logged in
users
prints on a single line a blank-separated list of user
names of users currently logged in to the current host. Each user name
corresponds to a login session, so if a user has more than one login
session, that user's name will appear the same number of times in the
output.
Synopsis:
users [ file ]
With no file argument, users
extracts its information from
the file `/etc/utmp'. If a file argument is given, users
uses that file instead. A common choice is `/etc/wtmp'.
The only options are `--help' and `--version'. See section Common options.
who
: Print who is currently logged inSynopsis:
who
[ option ] [ file ] [ am i ]
If given no non-option arguments, who
prints the following
information for each user currently logged on: login name, terminal
line, login time, and remote hostname or X display.
If given one non-option argument, who
uses that instead of
`/etc/utmp' as the name of the file containing the record of
users logged on. `/etc/wtmp' is commonly given as an argument
to who
to look at who has previously logged on.
If given two non-option arguments, who
prints only the entry
for the user running it (determined from its standard input), preceded
by the hostname. Traditionally, the two arguments given are `am
i', as in `who am i'.
The program accepts the following options. Also see section Common options.
who
.
`+' allowingwrite
messages `-' disallowingwrite
messages `?' cannot find terminal device