2

In Linux, how do I get a list of all the groups a particular user is a member of?

8

If you are the user:

groups

If he is someone else:

groups hisname
| improve this answer | |
2

Use the groups command, i.e.

groups username
| improve this answer | |
1

The id command will list group memberships by both name and id number.

| improve this answer | |
0

You could simply pilfer through the /etc/group file. It has a simple format: groupname: username, username2, username3, with one group per line.

Or, grep through it.

grep '[:,]username' /etc/group
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.