Skip to main content

Linux Group Commands

Manage group accounts and group membership in the Linux operating system.

Command
Function
Flags
groupadd Creates a new group. -g (Defines the group ID)
-p (Defines the group password)
-r (Makes the new group a system group)

groupmod

Modifies the existing group.
groupdel Modifies the system account files by deleting all entries that refer to the specified group.
gpasswd Changes a group password. -r (Removes a group password)
newgrp Used to change the current group IP during a login session.
usermod Modifies group membership for the user account.

-g (Assigns a user to a primary group)

-G (Assigns a user to a secondary group)

-aG (Assigns a user to a secondary group by adding it to the list of secondary users)

-G "" (Removes the user from all secondary group memberships)

groups Displays the primary and secondary group membership for the specified user account.