Linux groupdel command
On Unix-like operating systems, the groupdel command removes a group.
This page describes the GNU/Linux version of groupdel.
Conditions
You may not remove the primary group of any existing user; you must remove the user before you remove that user's primary group.
You should manually check all file systems to ensure that no files remain owned by this group. groupdel does not automatically check for files owned by the deleted group.
Syntax
groupdel group
Configuration
The following configuration variable, located in /etc/login.defs, changes the behavior of groupdel:
MAX_MEMBERS_PER_GROUP (number)
Maximum members per group entry. When the maximum is reached, a new group entry (line) is started in /etc/group (with the same name, same password, and same GID).
The default value is 0, meaning there are no limits in the number of members in a group.
This "split group" feature is primarily used to limit the length of lines in the group file. This is useful to make sure that lines for NIS (Network Information Service) groups are not larger than 1024 characters.
If you need to enforce such limit, you can use 25.
Split groups may not be supported by other tools and programs. You should not use this variable unless you need it.
Exit values
The groupdel command exits with the following values:
0 | Success. |
2 | Invalid command syntax! |
6 | Specified group doesn't exist. |
8 | Can't remove user's primary group. |
10 | Can't update group file. |
Examples
For this command to work, you must have superuser rights or be logged in as root.
groupdel newgroup
In this example, the groupdel command would delete the group newgroup.
Related commands
gpasswd — Administer /etc/group and /etc/gshadow.
groupadd — Add a group to the system.
groupmod — Modify a group definition.