Finding all the members of a group is an occasional requirement and while there are a number of ways to do this by parsing the
/etc/password files, Debian/Ubuntu come with a simpler solution that performs all this skulduggery for you. This is the
members function that can simply be installed using
sudo apt-get install members . Once this is done, members of a group named
foo can be listed using:
The function also supports a few options to differentiate between primary and secondary group members. The man page is as follows:
members - outputs members of a group
This manual page documents briefly the members commands. This manual page was written for the Debian GNU/Linux distribution.
members is a program that sends a space-separated list of secondary member names to its standard output.
The programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below.
Show all group members on one line. This is the default.
Show only primary group members.
Show only secondary group members.
Send two lines to standard output. First line is primary members, second line is secondary members. NOTE: This always displays two lines, even if there are no members at all.
Show summary of options.
I'm not sure if this package is available for other distributions. It probably is.
Hope this helps.
- Log in to post comments