members in a group

Hi all,
I am new to Linux.Can anyone tell me how to display or list all the members in a group?

Thanks in advance.

Look out for the following files:

/etc/passwd and /etc/group

Hope this helps!

nua7

one way, assume we want the group called prog:

grep '^prog' /etc/group

Use the command:
# groups

Rgs,
Oktawik

groups will simply list out the groups avalaible on the system. It won't give you the members associated with them.

Grepping on /etc/group with the desired group name would do the trick.

On my Linux at least, groups era prints which groups I am a member of.

Thank you all...

Hi,

just u search in
#vi /etc/passwd and
#vi /etc/group
#groups
#logins

Arjun

I'm no linux expert, but this is will accomplish what you are looking for. You must include the back ticks around the command.

`awk -F":" '{ print "groups " $1 }' /etc/passwd ` 2>nul

I don't know why the output displays
id: groups: No such user
after each line but piping the error output to nul removes this.

To explain my previous post,
groups user
will display the groups of a single user.

Using the awk command from the last posting will run groups for each user found in the /etc/passwd file.
-F: uses : as the field separator,
%1 is the first field in the file,
`` runs the output from the awk command
2>nul hides the err output from the command