List Groups A User Belongs To In Unix

Still seeing this request quite frequently in my website logs, I thought I'd expand the topic a bit more, given the fact that I've somehow left out the most obvious way to confirm the group membership for a Unix user.

Group membership in Unix

Every Unix-like OS is bound to have a group command, which is aimed to help you confirm Unix group membership for any user known to your system.

The easiest it to run it and specify a username in command line. The result is a list of Unix groups:

ubuntu$ groups greys
greys : admin www-data

If you're looking at confirming the membership for a few users, you can specify usernames in the same command line:

ubuntu$ groups greys root
greys : admin www-data
root : root

There you go – hopefully this satisfies your interest. Good luck with Unix experiments!

See also:

Related posts:


These posts may have more info on lsit user gorups:

  - No related posts.


2 comments ↓

#1 How To Create User Accounts in Unix | UNIX Tutorial: Learn UNIX on 12.24.08 at 1:13 am

[...] How to list groups a user belongs to [...]

#2 Spencer Hill on 12.01.10 at 9:32 am

Nice clean tutorial, nice clean site… way to go man!

Leave a Comment