Goal / Scope
Provide examples of effective ways to determine and display the UID and / or GID of an account.
Methodology / Process Steps
The id command is used to display a user UID / GID in Linux and / or Unix. To obtain the UID of an account, the -u switch is used as shown in the example below.
id -u [username]
where [username] is the username of the account.
To display the GID of an account, the -g switch is used. The example below shows how the -g switch can be used similar to the -u example above.
id -g [username]
The next example may not be very useful at first glance, but it will provide a list of all the UIDs of the groups a user has membership in.
id -G [username]
Finally, if a list of the group names along with the UID of the group is required, simply executing the command without any switches will provide this result.
These commands can be issued as a standard user.
Indiana University Knowledge Base