groupls
is a Unix command-line utility to explore group memberships. Ever wanted to find
a list of all users belonging to a group? GroupLS can do that for you.
With this tool, you can see all the users belonging to a group, all the groups a user belongs to, or just a list of all the groups on the system. Future plans include a "tree view" where you can view a more detailed overview detailing both the groups available as well as the users in each group.
You can easily output to JSON, ready to be parsed by another utility such as jq
. Just add the --json
flag to your command.
groupls
does not, sadly, support network-attached users or groups, such as those stored in an LDAP directory or stored in any way other than the standard /etc/passwd
and /etc/group
files. This may be supported in a future release if there is enough demand.
This program was written entirely in Rust. The intention was to serve as a personal project for yours truly to learn the language.
If you have feedback or suggestions on how you would like groupls
to work,
I would love to hear! Just shoot me an email, or open an issue.
On BSD, run ./install-bsd.sh
On Linux, run ./install-linux.sh
$ # simple zero-arg usage -- lists all groups
$ groupls
nobody
nogroup
wheel
daemon
sys
tty
operator
mail
bin
owner
everyone
_taskgated
group
staff
_www
$ # list all users belonging to a group
$ groupls -g _www
_www
_teamsserver
_devicemgr
$ # list all groups that the user _www is in
$ groupls -u _www
_www
$ # list all the groups that user _teamsserver is in
$ groupls -u _teamsserver
mail
_www
_calendar
_teamsserver
_odchpass
_postgres
_webauthserver
$ # Add --json for easy JSON output!
$ groupls --json -u _teamsserver
{"apiVersion":"1.0","user":{"user_name":"_teamsserver","groups":[{"name":"mail","id":6},{"name":"_www","id":70},{"name":"_calendar","id":93},{"name":"_teamsserver","id":94},{"name":"_odchpass","id":209},{"name":"_postgres","id":216},{"name":"_webauthserver","id":221}]}}