Listing the members of a group
I'm running Fedora Core6.
What is the console command with which I can list all the users belonging to a certain group? |
Hi.
Have a look in /etc/group , or run the following (this would be for the group 'dave'): Code:
egrep '^dave' /etc/group | awk -F ':' '{print $4}' |
Not lazy enough ... ;}
Code:
awk -F: '/^dave/ {print $4}' /etc/group Cheers, Tink |
He he. Nice.
|
Quote:
Code:
awk -F: '/^fred/{print $1","$4}' /etc/group |
But then why would I want to print what I entered to begin with? I mean,
I know that I'm looking for group dave, and that there's (hopefully) only going to be ONE group by that name ... of course, if I searched for adm and there was an adm and an admin group I'd get them both ... hmmm ... Oh well... [edit] Slightly more verbose but works around the issue described above ... Use equality instead of a regex ;D Code:
awk -F: '$1 == "nogroup" {print $4}' /etc/group Cheers, Tink |
All times are GMT -5. The time now is 12:59 PM. |