N
N
nano_e_t_42019-09-25 00:43:17
linux
nano_e_t_4, 2019-09-25 00:43:17

How to see all users in a group?

Hello everyone
Please tell me how to see all the users who are in the group? (the task was set like this)
getent group GroupName gives out unfortunately not all ( https://unix.stackexchange.com/questions/241215/ho...

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
sash999, 2019-09-25
@sash999

cat /etc/group | grep 'GROUP_NAME:' | cut -f 4 -d ':'

K
ky0, 2019-09-25
@ky0

And what did not suit the first answer on your link?

You can use grep:
grep '^group_name_here:' /etc/group
This only lists supplementary group memberships, not the user who have this group as their primary group. And it only finds local groups, not groups from a network service such as LDAP.

D
dpsz, 2019-09-25
@dpsz

There is a members utility. That's exactly what it's designed for.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question