return userid (POSIX)
id [username] id -G[-n] [username] id -g [-nr] [username] id -u [-nr] [username]
Write information on current IDs (real and effective):
$ id uid=109(eric) gid=120(techies)
Write the effective groupid as a number:
$ id -g 120
Write the effective groupid as a name:
$ id -gn techies
The id utility writes the current real and/or effective userid and groupid.
When no options are specified, output is as follows:
If the effective user ID is different from the real userid, the effective userid will also appear:
Likewise, if the effective groupid is different from the real groupid, the effective groupid will appear as well:
If no entry exists for an ID in the /etc/passwd or /etc/group files, the output will lack the (name) after the numerical value. No error is generated.
If a username is supplied as an operand, the effective uid and gid won't appear since there's no process associated with it — the information is simply looked up in the /etc/passwd and /etc/group files.
When options are specified, the requested data is written as an unsigned integer, unless option -n is specified, in which case the data is written as the corresponding user or group name. With option -G, the id utility might produce two lines of output (one value per line) if the real and effective IDs differ. In all other cases, id always produces one line of output.