About Us Documentation

Contact Site Map



Go to the previous, next chapter.

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.


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 - -g - --group - Print only the group id.

-G - --groups - -G - --groups - Print only the supplementary groups.

-n - --name - -n - --name - Print the user or group name instead of the ID number. Requires -u, -g, or -G.

-r - --real - -r - --real - Print the real, instead of effective, user or group id. Requires -u, -g, or -G.

-u - --user - -u - --user - Print only the user id.

logname: Print current login name

@flindex /etc/utmp @flindex utmp

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.


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.


users [ file ]

@flindex /etc/utmp @flindex /etc/wtmp 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


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.

@flindex /etc/utmp @flindex /etc/wtmp 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.

am i - who am i - 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 - -m - Same as who am i.

-q - --count - -q - --count - Print only the login names and the number of users logged on. Overrides all other options.

-s - -s - Ignored; for compatibility with other versions of who.

-i - -u - --idle - -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 - -H - --heading - Print a line of column headings.

-w - -T - --mesg - --message - --writable - -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

To return to the Ready-to-Run Software Super ReadyPak Table of Contents please press here.


Email addresses listed on this site may  NOT be used for unsolicited commercial email.

Ready-to-Run Software, Inc Privacy Statement

Portions (c)Copyright, 1996-2005 by Ready-to-Run Software, Inc
(All rights reserved.)
212 Cedar Cove
Lansing, NY 14882
Phone: 607 533 UNIX (8649)
Fax: 607 533 4002