Permissions
groups
Print group memberships for users.
groupuserpermissionsmembership
Additional Notes
groups prints the groups a user belongs to. Groups are used to share permissions for files, devices, services, and administrative roles.
It is a quick way to check whether a user belongs to groups such as sudo, docker, audio, or project-specific groups.
Syntax
groups [user...]
Parameters
options: Flags that change howgroupsbehaves.user: User account affected by the command.group: Group account affected by the command.file: File or directory whose ownership, mode, or access policy is being changed.
Examples
groups
Show groups for the current user.
groups rani
Show groups for user rani.
id -nG
Alternative command that prints group names.
Practical Notes
- Group changes usually apply after a new login session.
- Use
usermod -aG group userto add a user to a supplementary group. - Use
idfor UID/GID details. - Being in powerful groups like
sudoordockercan give administrative-level access.