The groupmems command’s switches with example – Unix/Linux

The command ‘groupmems’ is used to administrate Linux groups.
Syntax:

# groupmems -a user_name | -d user_name | [-g group_name] | -l | -p

Switches with example:

1, -a, –add user_name

Add an user to the group membership list.
If the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a new entry will be created.

[[email protected] ~]# groupmems -g grptest -a crybit
[[email protected] ~]# groupmems -g grptest -a crybit 
groupmems: user 'crybit' is already a member of 'grptest'
[[email protected] ~]# groupmems -g grptest -a me

2,-d, –delete user_name

Delete a user from the group membership list.
If the /etc/gshadow file exist, the user will be removed from the list of members and administrators of the group.
If the /etc/gshadow file exist, and the group has no entry in the /etc/gshadow file, a new entry will be created.

[[email protected] ~]# groupmems -g grptest -d crybit
[[email protected] ~]# groupmems -g grptest -d crybit
groupmems: user 'crybit' is not a member of 'grptest'
[[email protected] ~]# groupmems -g grptest -d me

3, -g, –group group_name

The superuser can specify which group membership list to modify.

4, -l, –list

List the group membership list.
Example:

[[email protected] ~]# groupmems -g grptest -a me
[[email protected] ~]# groupmems -g grptest -a crybit
[[email protected] ~]# groupmems -g grptest -l
me  crybit

5, -p, –purge

Purge all users from the group membership list.
Example:

[[email protected] ~]# groupmems -g grptest -l
me  crybit 
[[email protected] ~]# groupmems -g grptest -p
[[email protected] ~]# groupmems -g grptest -l

Its simple, right? 🙂

groupdel, groupadd, groupmod,

Arunlal Ashok

Linux Server Administrator. I'm dealing with Linux servers since 2012. I started this blog to share and discuss my ideas with the world. Check My Profile!! in uPwork (oDesk) and let me know if you need any assistance. Thanks!!

You may also like...

7 Responses

  1. February 1, 2014

    […] Links : groupadd , groupmems, […]

  2. February 1, 2014

    […] Links: groupdel, groupmems, groupmod, […]

  3. February 1, 2014

    […] Links: groupdel, groupmems, groupmod, […]

  4. February 1, 2014

    […] Links: groupdel, groupmems, […]

  5. February 6, 2014

    […] commands, groupdel, groupmems, groupmod, useradd , usermod , chgrp, chown, ls, head, tail, top, ps, find, […]

  6. February 7, 2014

    […] useful commands: groupdel, groupmems, groupmod, useradd , usermod , chgrp, chown, ls, head, tail, top, ps, find, crontab, ftp […]

  7. February 7, 2014

    […] useful commands: groupdel, groupmems, groupmod, useradd , usermod , chgrp, chown, ls, head, tail, top, ps, find, crontab, ftp commands, […]

Leave a Reply

Your email address will not be published. Required fields are marked *