DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

id(C)


id, whoami -- print user and group IDs and names

Syntax

id [ -l ] [ -s ] [ user ]

id -G [ -n ] [ user ]

id -g [ -n ] [ -r ] [ user ]

id -u [ -n ] [ -r | -l ] [ user ]

whoami

Description

whoami- display effective user ID as name

In the first form, the id command writes a message on the standard output, giving the user and group ID's and the corresponding names of the invoking process, or the specified user. If the effective and real ID's do not match, both are printed.

The whoami utility displays the effective user ID as a name, and is equivalent to id -un.

If the user is a member of any supplemental groups, id also shows these. On systems that support a large number of supplemental groups this may make the output very long.

The -s flag is for backwards compatibility and has no effect.

With the -l option, id also outputs the Login User ID (LUID) of the caller.

In the second form, the id command writes three lines of information on the standard output. The first line contains the effective group ID, and the second the real group ID; the last line contains a space-separated list of supplemental groups. Normally the output is in numeric form, but specifying the -n flag shows the ID's in name form.

The third form of id writes the effective group ID of the invoking process, or of the given user in numeric form. The -n flag causes output to be the name of the group, and the -r flag shows the real group ID.

The final form of id writes the effective user ID of the invoking process, or of the given user in numeric form. Again, the -n flag causes the output to be in name form; the -r flag shows the real user ID, and the -l flag shows the login user ID.

When id is given the optional user name, the real, effective and login ID's are always the same. The user and group ID's are taken from the password database entry for that user. The supplemental group list is taken to be all the entries in the group database for that user, the supplemental group list of a process being a subset of these.

Exit values

id returns the following values:

0
successful completion

>0
an error occurred

Examples

id -l produces output with the following format on a single line:
   uid=12460(fred) gid=7003(trusted) luid=12460(fred)
   groups=7003(trusted),50(group)
id -G produces:
   7003
   7003
   7003 50
id -g -r would output:
   7003
id -u -l -n would output:
   fred
id daemon would produce:
   uid=1(daemon) gid=1(other) groups=1(other),2(bin),4(adm),12(daemon)

See also

getuid(S-osr5), group(F), logname(C), passwd(F), sg(C)

Standards conformance

id is conformant with:

ISO/IEC DIS 9945-2:1992, Information technology - Portable Operating System Interface (POSIX) - Part 2: Shell and Utilities (IEEE Std 1003.2-1992);
AT&T SVID Issue 2;
X/Open CAE Specification, Commands and Utilities, Issue 4, 1992.


© 2007 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 05 June 2007