commands

groups — list group names

Without a user, displays group membership of the current process. With a user, queries account group membership. Newly assigned groups may not appear in existing sessions. Example assumes a fresh account lab fixture; VM-only examples require explicit authorization.

Formal Syntax & Structure

linux syntaxlinux
groups [USER...]

Parameters & Attributes

NameTypeDescription
USERoperandoptional account name

Return Value

exit status and output

Without a user, displays group membership of the current process. With a user, queries account group membership. Newly assigned groups may not appear in existing sessions.

Working Example

Example Snippetlinux
test -n "$(groups)" && printf "groups reported\n"
Linux Reference