Skip to content

Linux group related commands

This article introduces linux group management related commands, including adding groups, deleting groups, modifying groups, setting group administrators, viewing groups to which users belong, etc.

groupadd

This command is used to create a new group.

create a group named as group_name

sudo groupadd group_name

groupmod

This command is used to modify attribute of the group.

change group name

sudo groupmod -n origin_group_name new_group_name

add user to the group

sudo groupmod -G group_name user_name

groupdel

This command is used to delete the group.

delete one group

sudo groupdel group_name 

gpasswd

This command is used to manage members of the group.

add user to the group

sudo gpasswd -a user_name group_name 

delete a user from group

sudo gpasswd -d user_name group_name 

set a user as admin of the group

sudo gpasswd -A user_name group_name

groups

This command is used to show the groups that the user belongs to.

show user’s groups

sudo groups user_name
Leave a Reply