Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 02-13-2006, 05:08 AM   #1
Registered: Aug 2005
Distribution: Debian 'lenny'
Posts: 208

Rep: Reputation: 30
Is there a command to show the the member(s) of a group?

'groups username' shows the group(s) the user belongs to. Is there a command to show the member(s) of a group?

Thanks !
Old 02-13-2006, 05:26 AM   #2
Registered: Nov 2005
Distribution: xubuntu, grml
Posts: 451

Rep: Reputation: 37
apropos group
gave me: man group
which points to:
cat /etc/group
It doesn't really give all info though, it does not say that i'm part of the users group which is weird ..
Old 02-13-2006, 05:32 AM   #3
Senior Member
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
grep group_name /etc/group
[scuzzy@slackdell /home/scuzzy]$ grep users /etc/group
[scuzzy@slackdell /home/scuzzy]$ grep music /etc/group
[scuzzy@slackdell /home/scuzzy]$
Old 02-13-2006, 05:34 AM   #4
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
grep '<group-name>' /etc/group

The members of a group are listed after the third colon.

In a script, you could do something like:
sed -n "/${1}/s/.*:.*:.*://p" /etc/group
Set the executable bit, and copy it to your $HOME/bin/. Now you have the command you want. A comma seperated list of the members is printed.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Member of local and remote group at the same time? xtrax Linux - General 3 12-20-2004 08:36 PM
LQ member progress status from member to senior member............. emailssent LQ Suggestions & Feedback 3 10-11-2004 02:31 PM
Why does mysqld not show up w/ps command baandar Linux - Software 3 09-01-2004 03:21 AM
What command to show mandrake version? minorgod Linux - Software 4 07-05-2004 10:30 PM
Command 2 Show sys Spec Thom_Redhat Linux - General 1 11-11-2003 01:32 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:08 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration