How to check current user ID?

To check the current user ID in a Linux environment, you can use the id command. This command provides information about the user, including the user ID (UID) and group ID (GID).

Usage

You can run the following command in the terminal:

id

Output

The output will display information similar to this:

uid=1001(labex) gid=1001(labex) groups=1001(labex)

In this output:

  • uid=1001 indicates the user ID.
  • gid=1001 indicates the group ID.
  • groups=1001(labex) shows the groups the user belongs to.

If you want to check just the user ID, you can use:

echo $UID

This will output only the user ID number.

0 Comments

no data
Be the first to share your comment!