[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20. User information

This section describes commands that print user-related information: logins, groups, and so forth.

20.1 id: Print real and effective uid and gid  Print real and effective uid and gid.
20.2 logname: Print current login name  Print current login name.
20.3 whoami: Print effective user id  Print effective user id.
20.4 groups: Print group names a user is in  Print group names a user is in.
20.5 users: Print login names of users currently logged in  Print login names of users currently logged in.
20.6 who: Print who is currently logged in  Print who is currently logged in.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.1 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 2. 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.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.2 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 2. Common options.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.3 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 2. Common options.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.4 groups: Print group names a user is in

groups prints the names of the primary and any supplementary groups for each given username, or the current process if no names are given. If 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 2. Common options.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.5 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 2. Common options.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

20.6 who: Print who is currently logged in

who prints information about users who are currently logged on. 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 2. 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.

`-l'
`--lookup'
Attempt to canonicalize hostnames found in utmp through a DNS lookup. This is not the default because it can cause significant delays on systems with automatic dial-up internet access.

`-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


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Jeff Bailey on December, 28 2002 using texi2html