groupdel

Linux · Users and permissions · reference only

What it does

Deletes a group from the system. By default it refuses to delete a group that is some user's primary group.

Syntax

groupdel [opciones] grupo

Options and parameters

  • grupo

    Name of the group to delete.

  • -f

    Forces removal even if it is some user's primary group.

  • -R DIR

    Applies the changes inside the given root directory (chroot).

  • -h

    Shows help and exits.

Usage examples

  • sudo groupdel devs

    Deletes the devs group.

  • getent group devs

    If the group was deleted, it prints nothing.

  • sudo groupdel -f antiguos

    Forces the removal of a group that is still some user's primary group.

Notes and common mistakes

  • To delete a primary group, first change the user's group with usermod -g or delete the user.
  • Files that belonged to the group keep an orphan GID.

Related commands