Delete groups

To delete a group in Linux, you can use a tool called delgroup. delgroup is a friendlier front-end to the groupdel program. The delgroup command takes a single parameter: the group name. Note that you can’t delete the primary group of an existing user: you must delete the user first or change its primary group.

Let’s delete the group we’ve created in the previous section:

linux delgroup command

 

You can also delete a group by editing the /etc/group file, but it is recommended to use the delgroup command. delgroup checks whether the group is any user’s primary group and if it is, refuses to remove the group.
Geek University 2022