HP-UX Reference (11i v2 07/12) - 1 User Commands A-M (vol 1)

i
id(1) id(1)
NAME
id - print user and group IDs and names
SYNOPSIS
id [-u][-nr][user]
id [-g][-nr][user]
id [-G][-n][user]
id [-P]
DESCRIPTION
The id command writes a message to standard output, giving the user and group IDs and names for the
process. If the effective and real IDs are different, both are printed.
If the process has supplementary group afliations (see groups(1)), the supplementary group affiliations are
also written.
If the user operand is specified and the process has appropriate privileges, the user and group IDs of the
selected user are written. In this case, effective IDs are assumed to be identical to real IDs. If the selected
user has more than one allowable group membership listed in the group database, then the group member-
ship information is written.
Options
The following options modify the behavior described above.
-g Display only the group ID. The default is the effective group ID; to modify, use the
-r option. If
the process has supplementary group affiliations that are different from the effective group ID
(or the real ID if the
-r option is used), display each such afliation on the same line. The
default is decimal format; to modify, use the -n option.
-G Output all different group IDs (effective, real, and supplementary) only, using the format
"%u\n". If there is more than one distinct group afliation, output each such affiliation, using the
format " %u", before the <newline> is output.
-n With A -u, -g,or-G, display the ID name instead of the ID number.
-r With -u, -g,or-G, display the real ID instead of the effective ID.
-u Display only the user ID. The default is the effective user ID; to modify, use the
-r option. The
default is decimal format; to modify, use the
-n option.
-P Displays process resource group ID for the process along with the user and group IDs and
names. The
-P option ignores user argument. See HP Process Resource Manager in DEPEN-
DENCIES.
RETURN VALUE
The error codes returned by
id are :
0 Success.
1 User not found or invalid options or invalid combination of options.
2 The -P option is given when PRM is not supported or configured.
EXAMPLES
To display the current user and group data:
id
produces:
uid=1834(allanp) gid=20(users)
To display the group ID number for the current process:
id -g
produces:
20
HP-UX 11i Version 2: December 2007 Update 1 Hewlett-Packard Company 423