How to Find UID and GID

By Kristen Waters

The Linux and Unix operating systems use the UID -- user ID -- to identify a particular user. The GID, or group ID, is used to identify a group. Each user will have a single, unique UID and a primary GID. The user can belong to several secondary groups and each secondary group will have a unique GID. The "id" command can be used to show the UID and GIDs for a particular user. The root (super) user can view the UID and GID for any user. If you do not have root privileges, you can only view your own UID and GID.

Things You'll Need

  • Linux or Unix operating system

Step 1

Open a terminal window. The terminal application is usually found in the "Accessories," "Utilities" or "Tools" section of the main "Programs" or "Applications" menu.

Step 2

Type the command "su" to become the root user. Skip this step if you do not have root user privileges or want to find the UID or GID for your own account.

Step 3

Type the command "id -u" to find the UID for a particular user. Replace "" with the user's Unix or Linux username.

Step 4

Type the command "id -g" to find the primary GID for a particular user. Replace "" with the user's Unix or Linux username.

Step 5

Type the command "id -G" to list all the GIDs for a particular user. Replace "" with the user's Unix or Linux username.

Step 6

Type the command "exit" to close the root user session.