2

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

0

4 Answers 4

8

If you are the user:

groups

If he is someone else:

groups hisname
2

Use the groups command, i.e.

groups username
1

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

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .