Displays the system identifications of a specified user.
id [ { -G | -g [ -r ] | -u [ -r ] } [ -n ] ] [ User ]
The id command writes to standard output a message containing the system identifications (ID) for a specified user. The system IDs are numbers which identify users and user groups to the system. The id command writes the following information, when applicable:
Supplementary group information is written only for systems supporting multiple-user groups and only if the specified user belongs to a supplementary group.
The id command also writes effective user and group IDs, but only for the user that invoked the id command. (If the User parameter is specified with the id command, the effective IDs are assumed to be identical to real IDs.) If the effective and real IDs for the invoking user are different, the id command writes the following effective ID information, when applicable:
The id command will fail if the specified user does not exist or if the command cannot read the user or group information.
The contents and format of the
message written by the id command can be altered with the following
flags:
Access Control: This program should be installed as a normal user program in the Trusted Computing Base.
This command returns the following
exit values:
0 | Successful completion. |
>0 | An error occurred. |
id
Output for the id command is displayed in the following format:
uid=1544(sah) gid=300(build) euid=0(root) egid=9(printq) groups=0(system),10(audit)
In this example, the user has user name sah with an ID number of 1544; a primary group name of build with an ID number of 300; an effective user name of root with an ID number of 0; an effective group name of printq with an ID number of 9; and two supplementary group names of system and audit, with ID numbers 0 and 10, respectively.
id -G
Output is displayed in the following format:
0 10 300 9
The -G flag writes only the group IDs for a user. In this example, user sah is a member of the system (0), audit (10), build (300), and printq (9) groups.
id -Gn
Output is displayed in the following format:
system audit build printq
The -n flag writes only the names instead of the ID numbers.
id -gnr
Output is displayed in the following format:
build
/usr/bin/id | Contains the id command. |
The getty command, login command, setgroups command, su command, tsm command.