id
Print real and effective user and group IDs
Overview
The id command prints user and group information for the specified USER, or (when USER is omitted) for the current user.
Syntax
id [OPTION]... [USER]Common Options
-u, --userPrint only the effective user ID.
-g, --groupPrint only the effective group ID.
-G, --groupsPrint all group IDs (effective).
-n, --namePrint name instead of ID number (for use with -u, -g, -G).
-r, --realPrint real ID instead of effective ID (for use with -u, -g, -G).
-Z, --contextPrint only the security context of the process (e.g., SELinux).
-z, --zeroDelimit entries with NUL characters, not whitespace; useful with -G, -g, or -u for scripting.
Examples
Displays all user and group ID information for the current user (UID, GID, groups).
Displays all user and group ID information for some_user.
Prints the effective user ID number of the current user.
Prints the name corresponding to the effective user ID of the current user.
Prints the effective group ID number of the current user.
Prints the name corresponding to the effective group ID of the current user.
Prints all effective group ID numbers the current user belongs to.
Prints all effective group names the current user belongs to.
Prints the real user name of another_user.