Access to the Unix group file in Perl 6
Perl 6
Switch branches/tags
Latest commit a87fdaa Nov 4, 2017 @jonathanstowe jonathanstowe Add changes
Failed to load latest commit information.
lib/Unix Remove version literal Mar 12, 2016
t Add groups-for-user Oct 28, 2015
.gitignore Add precomp to .gitignore Dec 24, 2015
.travis.yml Alter travis config to use zef Aug 2, 2017
Changes Add changes Nov 4, 2017
LICENCE rename LICENCE as en_GB May 30, 2016
META6.json Fix licence Apr 22, 2017 No panda Aug 21, 2017


Access to the Unix group file in Perl 6


use Unix::Groups;

my $groups =;

say "The logged in user is member of these groups:";

for $groups.groups-for-user($*USER.Str) -> $group {
	say $;


This module provides access to the group details from /etc/group, with similar to getgrent(), getgrnam and getgrgid in the Unix standard C library.

The methods either return a Unix::Groups::Group object or an array of those objects.

Because this module goes directly to the group file, if your system is configured to retrieve its group information from e.g. NIS or LDAP it may not necessarily reflect all the groups present, just the local ones.


Assuming you have a working Rakudo Perl 6 installation you should be able to install this with zef :

# From the source directory

zef install .

# Remote installation

zef install User::Groups


Suggestions/patches are welcomed via github at:


This is free software.

Please see the LICENCE file in the distribution

© Jonathan Stowe 2015, 2016, 2017