Windows
Linux
Security & Permissions
Users & Groups
Windows net localgroup equivalent in Linux
Creates groups, adds users to groups, and lists group memberships.
Windows
→
net localgroup
Linux equivalents
groupadd / groups
groupadd / groups
groupadd / groups
Overview
What this command does
Creates groups, adds users to groups, and lists group memberships.
Migration tip: Groups are central to Linux security. Adding a user to a group (like
docker or sudo) grants them extra permissions without giving full root access.Practical tasks
Common use cases
Manage user groups
Creates groups, adds users to groups, and lists group memberships.
groups username
List groups a user belongs to
groupadd groupname
Create a new group
usermod -aG group user
Add user to group (-a means append)
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
groups john
sudo groupadd developers
sudo usermod -aG developers john
sudo usermod -aG docker john
Walkthrough
Examples with explanations
# Windows: net localgroup Administrators john /add
groups john # what groups is john in?
sudo groupadd developers # create a new group
sudo usermod -aG developers john # add john to it
# Allow john to run Docker without sudo:
sudo usermod -aG docker john
(log out and back in for changes to take effect)
Reference
Common options and variations
| Command or option | Use |
|---|---|
groups username | List groups a user belongs to |
groupadd groupname | Create a new group |
usermod -aG group user | Add user to group (-a means append) |
gpasswd -d user group | Remove user from group |
cat /etc/group | List all groups on the system |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | groupadd / groups |
Same command on this distribution. |
| Fedora | same command | groupadd / groups |
Same command on this distribution. |
| Arch | same command | groupadd / groups |
Same command on this distribution. |
Important
What to watch out for
The -a flag in usermod -aG means 'append'. Without it, the user is removed from ALL other groups. Always use -aG together.
Keep learning