id(1)
Print user and group IDs and names for the current user or a specified user.
Synopsis
id [OPTION]... [USER]Description
The id command displays the user ID (UID), group ID (GID), and all group memberships for the current user or a named user. It shows both numeric IDs and human-readable names, making it useful for debugging permission issues and understanding user roles.
When run without arguments, id shows the effective UID and GID. Use options to display only specific information or to show the real (login) IDs instead of effective ones.
Common options
| Flag | What it does |
|---|---|
-u | print only the effective user ID (UID) |
-g | print only the effective group ID (GID) |
-G | print all group IDs (including supplementary groups) |
-n | print names instead of numbers (use with -u, -g, or -G) |
-r | print real IDs instead of effective IDs (for setuid/setgid processes) |
-z | delimit output fields with NUL characters instead of whitespace |
--help | display help message and exit |
--version | display version information and exit |
Examples
show UID, GID, and all group memberships for the current user
idshow UID, GID, and group memberships for the user named john
id johnprint only the effective UID as a number
id -uprint only the effective username (not the UID)
id -unlist all group IDs (including supplementary groups) that the current user belongs to
id -Glist all group names (including supplementary groups) that the current user belongs to
id -Gnprint the real (login) UID, useful in setuid processes to see the original user
id -r -ushow UID, GID, and group memberships for the root user
id root