The title says it all. What command I need to run from a terminal to find my user ID (UID)?
14 Answers
There are a couple of ways:
Using the id command you can get the real and effective user and group IDs.
id -u <username>If no username is supplied to
id, it will default to the current user.Using the shell variable. (It is not an environment variable, and thus is not available in
env).echo $UID
Simply try
idThis will return your user ID, group ID, and all your groups.
3Try also :
getent passwd usernameThis will display user id , group id and home directory .
Or:
grep username /etc/passwd 2 You can use id command.