Linux and Unix id command

Quick links

About id
Syntax
Examples
Related commands
Linux and Unix main page

About id

Shows you the numeric user and group ID on BSD.

Syntax

id [-a] [-G] [-g] [-u] [user]

 

-aReports user name, use  ID and all the groups to which the user belongs.
-GOutput all different group IDs (effective, real and supplementary) only, using the format "%u\n". If there is more than one distinct group affiliation, output each such affiliation, using the format " %u", before the new line character is output.
-gOutput only the effective group ID, using the format "%u\n".
-nOutput the name in the format "%s" instead of the numeric ID using the format "%u".
-rOutput the real ID instead of the effective ID.
-uOutput only the effective user ID, using the format "%u\n".
userThe user (login) name for which information is to be written.

Examples

id

Typing id alone will report the user id and group similar to the below example.

uid=12345(comphope) gid=12(users)

Related commands

finger
fold
logname
who