id writes the following on the standard output for the invoking process:
the user ID (UID)
the login name
the group ID (GID)
the group name.
If the effective and real IDs/names are not identical, both are printed.
Syntax
Format 1: | id[ -a][ user] |
Format 2: | id -G[ -n][ user] |
Format 3: | id -g[ -nr][ user] |
Format 4: | id -u[ -nr][ user] |
(all) In addition to the ID and login name of the user, id reports all the groups to which the invoking process belongs and all the groups to which the invoking user belongs.
Login name for which the information is output. user not specified
Only the various group IDs (effective, real and supplementary) are output in the format "%u\n". If more than one group assignment is present then all group assignments are output in the format "%u" before the newline character.
Outputs the name in the format "%s" instead of the format "%u".
see format 1
Only the effective group ID is output.
Outputs the name as a string.
Only the real ID is output.
see format 1
Only the effective user ID is output.
Outputs the name as a string.
Only the real ID is output.
see format 1 |
File
/etc/group Group file containing group names and the associated group IDs and login names. |
Locale
The following environment variables affect the execution of id: LANG Provide a default value for the internationalization variables that are unset or null. If LANG is unset of null, the corresponding value from the implementation-specific default locale will be used. If any of the internationalization variables contains an invalid setting, the utility will behave as if none of the variables had been defined. LC_ALL If set to a non-empty string value, override the values of all the other internationalization variables. LC_CTYPE Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments and input files), the classification of characters as upper- to lower-case, and the mapping of characters from one case to the other. LC_MESSAGES Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error. NLSPATH Determine the location of message catalogs for the processing of LC_MESSAGES. |
Example
To check your current user ID, group ID, and their corresponding names, you enter:
|
See also
logname, newgrp, who, |