becko Asked: 2014-05-18 05:16:15 +0800 CST2014-05-18 05:16:15 +0800 CST 2014-05-18 05:16:15 +0800 CST How can I find my User ID (UID) from terminal? 772 The title says it all. What command I need to run from a terminal to find my user ID (UID)? command-line 4 Answers Voted Best Answer jobin 2014-05-18T05:21:06+08:002014-05-18T05:21:06+08:00 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 TAq 2014-05-18T05:20:41+08:002014-05-18T05:20:41+08:00 Simply try id This will return your user ID, group ID, and all your groups. nux 2014-05-18T05:28:26+08:002014-05-18T05:28:26+08:00 Try also : getent passwd username This will display user id , group id and home directory . Or: grep username /etc/passwd Diego Lopez 2014-05-18T05:23:29+08:002014-05-18T05:23:29+08:00 You can use id command. Manpage
There are a couple of ways:
Using the id command you can get the real and effective user and group IDs.
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
).Simply try
This will return your user ID, group ID, and all your groups.
Try also :
This will display user id , group id and home directory .
Or:
You can use
id
command.Manpage