{"id":8789,"date":"2020-07-19T07:59:51","date_gmt":"2020-07-19T11:59:51","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=8789"},"modified":"2021-12-04T07:36:15","modified_gmt":"2021-12-04T07:36:15","slug":"delete-group-linux-groupdel-delgroup","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/delete-group-linux-groupdel-delgroup\/","title":{"rendered":"How to Delete Group in Linux Using groupdel and delgroup"},"content":{"rendered":"\n
On Linux operating systems user groups are defined in the \/etc\/group<\/em> file. This is a simple text file that should not be edited directly. What if you want to delete group details? Well, Linux<\/a> provides command-line tools that will allow you to do it.<\/p>\n\n\n\n This guide makes assumptions that you have a complete Ubuntu server set up<\/a> with users already added to the system<\/a>.<\/p>\n\n\n\n In this guide, we will show you how to use the groupdel<\/em> command and delgroup<\/em> commands to delete all the group information.<\/p>\n\n\n\n How to delete a group in Linux where groupname<\/em> is the name of the group:<\/p>\n\n\n\n or<\/p>\n\n\n\n You can list the existing groups using the following command:<\/p>\n\n\n\n How about if you want to find out which groups a particular user belongs to. You can retrieve that information using the following command:<\/p>\n\n\n\n You can restrict deleting groups to if the group is a system group. This protects from accidentally deleting non-system groups.<\/p>\n\n\n\n You can also backup group files before deleting the group using this command:<\/p>\n\n\n\n If you just want to remove a user from a group you can use the following command:<\/p>\n\n\n\n The above commands work on all major Linux distros such as Arch Linux, CentOS<\/a>, Debian<\/a>, Fedora, RHEL, and Ubuntu<\/a> among others. Meanwhile, you can follow this guide on how to delete users from Linux found here<\/a> or this one about how to add a user in Linux systems<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":" On Linux operating systems user groups are defined in the \/etc\/group file. This is a simple text file that should not be edited directly. What if you want to delete…<\/p>\n","protected":false},"author":1,"featured_media":8790,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,16,18],"tags":[121,183,193,354,424,431,526,573,591,598],"yoast_head":"\nPrerequisites<\/h2>\n\n\n\n
$ sudo groupdel groupname<\/code><\/pre>\n\n\n\n
$ sudo delgroup groupname<\/code><\/pre>\n\n\n\n
$ sudo delgroup --group groupname<\/code><\/pre>\n\n\n\n
$ cat \/etc\/group<\/code><\/pre>\n\n\n\n
$ groups username<\/code><\/pre>\n\n\n\n
$ sudo delgroup --system --group groupname<\/code><\/pre>\n\n\n\n
$ sudo delgroup --backup --group groupname<\/code><\/pre>\n\n\n\n
$ sudo deluser username groupname<\/code><\/pre>\n\n\n\n
Conclusion on Delete Group in Linux<\/h2>\n\n\n\n