Go to the first, previous, next, last section, table of contents.

User information

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.

`-g'
`--group'
Print only the group id.
`-G'
`--groups'
Print only the supplementary groups.
`-n'
`--name'
Print the user or group name instead of the ID number. Requires -u, -g, or -G.
`-r'
`--real'
Print the real, instead of effective, user or group id. Requires -u, -g, or -G.
`-u'
`--user'
Print only the user id.

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 in

Synopsis:

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.

`-m'
Same as `who am i'.
`-q'
`--count'
Print only the login names and the number of users logged on. Overrides all other options.
`-s'
Ignored; for compatibility with other versions of who.
`-i'
`-u'
`--idle'
After the login time, print the number of hours and minutes that the user has been idle. `.' means the user was active in last minute. `old' means the user was idle for more than 24 hours.
`-H'
`--heading'
Print a line of column headings.
`-w'
`-T'
`--mesg'
`--message'
`--writable'
After each login name print a character indicating the user's message status:
`+' allowing write messages
`-' disallowing write messages
`?' cannot find terminal device

Go to the first, previous, next, last section, table of contents.