In Linux, how do I get a list of all the groups a particular user is a member of?
4 Answers
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