11 Vote

Linux: Get own User-ID / UID / GID

Question by Guest | Last update on 2021-04-07 | Created on 2017-09-28

How can I retrieve my own User-ID on Linux? Is it displayed somewhere? Where can I find it?

Is there perhaps some command for the Terminal available, which will show my own User-ID (UID) and my Group-ID (GID) as well?

ReplyPositiveNegative
1Best Answer1 Vote

You can just use the command "id" in the Terminal to display this information.

The output will be something like that:

id
uid=1000(uname) gid=2000(uname) groups= ...

In this case, the UID of the user "uname" is 1000, the GID of "uname" is 2000.

If you only want to display the UID or the GID of a specific user, you can use the commands "id -u <username>" and "id -g <username>". For example:

id -u uname
1000

id -g uname
2000

The first command only shows the UID, the second only the GID.
Last update on 2021-04-07 | Created on 2017-09-29

ReplyPositive Negative
Reply

Related Topics

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.