Deleting Groups

Deleting groups with groupdel

The groupdel command allows a System Administrator to remove groups from their Linux system.

Groupdel command options

Below are the options that can be used by the "groupdel" command.

Usage: groupdel [options] GROUP

  -h, --help                    display this help message and exit
  -R, --root CHROOT_DIR         directory to chroot into
  -P, --prefix PREFIX_DIR       prefix directory where are located the /etc/* files
  -f, --force                   delete group even if it is the primary group of a user
      --extrausers              Use the extra users database

Removing a group - groupdel command

To remove a group we use the "groupdel" command. The syntax for this command is: groupdel groupname

In its simplest from the "groupadd" command takes the syntax of:

groupdel group

[root@fedsrv01a ~]# grep testgroup /etc/group

[root@fedsrv01a ~]# groupdel testgroup

[root@fedsrv01a ~]# grep testgroup /etc/group
[root@fedsrv01a ~]# 

In the above example we used the "groupdel" command to remove a group called "testgroup".