Linux id command
On Unix-like operating systems, the id command prints the real and effective IDs of users and groups.
This document covers the GNU/Linux version of id.
Syntax
id [OPTION]... [USERNAME]
Description
Print user and group information for the specified USERNAME, or (when USERNAME omitted) for the current user.
Options
-a | Ignored; included for compatibility with other versions. |
-Z, –context | Print only the security context of the current user. |
-g, –group | Print only the effective group ID. |
-G, –groups | Print all group IDs. |
-n, –name | Print a name instead of a number, for -ugG. |
-r, –real | Print the real ID instead of the effective ID, with -ugG. |
-u, –user | Print only the effective user ID. |
–help | Display this help and exit. |
–version | Output version information and exit. |
If no OPTION is specified, id prints general user information.
Examples
id
Reports user and group IDs similar to the example below:
uid=12345(comphope) gid=12(users)
Related commands
finger — List information about a user.
logname — Return a user’s login name.
who — Report which users are logged in to the system.