How to get Linux user information from a User ID

This blog post talks about how you can get user information from a Linux User ID.

How to get Linux user information from a User ID

Sometimes you may only have a unix user ID and want to the user information. To accomplish this I am going to use the getent command. This goes through admin databases to find information about the user.

To find the details of a user from their user ID you can use the passwd database.

This can be accomplished using the following command.

getent passwd THEUSERID

Running this will return the user details from the passwd file. This includes information such as their shell, username and group ids.

Tags:

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.