id
id linux command cheatsheet by Thamizhiniyan C S
Introduction
The id command is used to print real and effective user and group IDs
Syntax
id [OPTION]... [USER]...
Important Flags
-g
Print only the effective group id.
-G
Print all Group ID’s.
-n
Prints name instead of number.
-r
Prints real ID instead of numbers.
-u
Prints only the effective user ID.
–help
Display help messages and exit.
–version
Display the version information and exit.
Examples
Print the current user's UID and GID.
Find the UID of the user named "root".
Find the GID of the user named "root".
Find the UID and all groups associated with the user "root".
Display the UID and all groups a user "root" belongs to.
Display the name instead of numbers for GID of "root".
Display the name instead of numbers for UID of "root".
Display the name instead of numbers for all groups of "root".
Display the real GID instead of effective GID of "root".
Display the real UID instead of effective UID of "root".
Display the real group IDs instead of effective groups of "root".
Last updated
Was this helpful?