All rights reserved, please indicate the source when citing
id id' - Display User ID Information
The 'id' command (print real and effective user and group IDs) conveniently displays user information such as UID, GID, and login name.
The syntax for 'id' is: id [OPTIONS] [USERNAME],
Commonly used options include:
- -u or --user: Display only the user ID (UID).
- -g or --group: Display only the primary group ID (GID).
- -G or --groups: Display a list of supplementary group IDs (GIDs).
- -n or --name: Display the user or group name instead of the ID number.
- -r or --real: Display the real ID instead of the effective ID (useful when using privilege escalation mechanisms like sudo).
- -Z or --context: Display the security context (if applicable).
Here are a few examples of using the id command:
$ id anges -Gn ←Display the groups that the user "anges" belongs to (equivalent to the "groups" command)
anges lib lab office
$ id ←display information about the currently logged-in user
|
Keep in mind that the id command provides important identity information about users and groups on the system, which can be useful for checking permissions and troubleshooting issues related to user and group access.
For more examples and option usages, please refer to the provided link.