Users

The groupmod command

Modifies an existing group, for example renaming it.

Syntax

sudo groupmod [-n NUEVO] grupo

Most useful options

-n NUEVOChanges the group name
-g GIDChanges the id

Copy-ready examples

$ sudo groupadd viejo && sudo groupmod -n nuevo viejo && getent group nuevoRename a group

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Renaming does not change the permissions of files that already used it by name.

Related commands

FAQ

Can I change only the GID?

Yes, with groupmod -g, but check the files that belonged to that group.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course