commands

id — inspect user and group identity

Reports identity and group membership. With no USER, describes the current process identity; -u selects effective UID, -g effective GID, -G supplementary and primary groups, -n names with selected ID option. Read-only; zero on success, nonzero on error. Example assumes a fresh permissions lab fixture.

Formal Syntax & Structure

linux syntaxlinux
id [OPTION] [USER]

Parameters & Attributes

NameTypeDescription
-uoptioneffective user ID
-goptioneffective group ID
-Goptiongroup IDs
-noptionnames
USERoperandoptional account

Return Value

exit status and output

Reports identity and group membership. With no USER, describes the current process identity; -u selects effective UID, -g effective GID, -G supplementary and primary groups, -n names with selected ID option. Read-only; zero on success, nonzero on error.

Working Example

Example Snippetlinux
test "$(id -u)" -ne 0 && printf "ordinary-user\n"
Linux Reference