Forrest logo
back to the id tool

id:tldr:b80bb

id: Display current user's ID (UID), group ID (GID) and groups to which they belong.
$ id
try on your machine

The "id" command in Linux and Unix systems displays the user and group information related to a particular user or the currently logged-in user. It reports the user's UID (user ID), GID (group ID), user name, primary group, and supplementary groups.

When executed without any arguments, the "id" command fetches and displays information about the currently logged-in user. The output typically includes the UID, GID, username, and groups associated with that user.

Example output:

uid=1000(john) gid=1000(john) groups=1000(john),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare)

Here:

  • "uid=1000" indicates the user's UID is 1000.
  • "gid=1000" indicates the primary group ID is 1000.
  • "groups=1000(john),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),116(lpadmin),126(sambashare)" lists the supplementary groups the user belongs to, specifying both the GID and group name.

The "id" command can also be used with a username as an argument to retrieve information about a specific user. For example, "id mary" would display the user and group details for the user named "mary".

Overall, the "id" command helps administrators verify and retrieve user-related information essential for granting permissions, managing access, and troubleshooting.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the id tool