id command in Linux with examples
Last Updated :
08 Apr, 2024
id command in Linux is used to find out user and group names and numeric ID’s (UID or group ID) of the current user or any other user in the server. This command is useful to find out the following information as listed below:
- User name and real user id.
- Find out the specific Users UID.
- Show the UID and all groups associated with a user.
- List out all the groups a user belongs to.
- Display security context of the current user.
Synopsis:
id [OPTION]… [USER]
Options:
- -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.
Note:
Without any OPTION it prints every set of identified information i.e. numeric ID’s.
Examples:
Share your thoughts in the comments
Please Login to comment...