Linux groups Command: Show a User's Group Memberships
groups shows the names of the groups the current user or a specified user belongs to. It is used to quickly check shared file access permissions or membership in administrative groups.
What is the groups command?
When run without arguments, it prints the list of groups for the current process. If you specify a user, it retrieves the group information for that account. If you need the numeric GID or the distinction between primary and supplementary groups, id provides more detailed information.
Basic syntax
groups [user...]
Installed implementations and options may vary depending on the distribution. Check the description for your system with man groups.
Examples
Check groups in the current session
See if the groups assigned to an account are reflected in the current shell.
groups
Check a specific user
Check which groups the account you are managing belongs to.
groups alice
Compare with numeric ID
When investigating permission issues, check both the group name and ID together.
id alice
Linking Group List to Permissions
groups shows the group names of the current user or a specified user. The output format may vary depending on the implementation and whether arguments are used.
groups alice
Example output:
alice : alice sudo
Here, the first alice is the user being queried, and the list after the colon is the group list. Changes in group membership may not be reflected in sessions that are already running immediately after the change. Check the group IDs actually applied to the current process using id.
Main Options and Format
| Options/Format | Description |
|---|---|
--help |
Show a simple usage of the GNU implementation. |
--version |
Show the version of the GNU implementation. |
Precautions when using
Changes may not be reflected in existing login sessions immediately after a group is newly added. Check groups and id in the current session and log in again if necessary. Just seeing the group name does not mean you have access to all paths. Parent directory permissions and ACLs also affect access.
Frequently Asked Questions
Why are the results of groups alice and groups without arguments different?
The former may query the account database anew, while the latter shows the list of groups that the current process has.
Official Documentation
The exact behavior of options and implementation differences can be checked in the official documentation related to groups.









