In this post I am going to tell you, how can you find the User ID and Group ID of a user in Linux. You might require it when you scripting something on the OS level.

We are going to use the id command to find the UID and GID of a user in Unix.

To find a specific user’s UID, goto the terminal and type the following (replace the username with the actual username) –
id -u username

To find a user’s GID, at the Unix prompt –
id -g username

If you wish to find out all the groups a user belongs to, type in –
id -G username

If you wish to see the UID and all groups associated with a user, enter id without any options –
id username

Hope this little trick helps you find some useful information.

Stay Digified !!
Sachin Khosla

Share this post: