How can I find my User ID (UID) from terminal?

There are a couple of ways:

  1. 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.

  2. Using the enviroment variable.

    echo $UID
    

Simply try

id

This will return your user ID, group ID, and all your groups.


Try also :

getent passwd username

This will display user id , group id and home directory .

Or:

grep username /etc/passwd