Windows
Linux
PowerShell Equivalents
Users & Groups
Windows PowerShell Add-LocalGroupMember equivalent in Linux
Adds an existing user to a supplementary group.
Windows
→
PowerShell Add-LocalGroupMember
Linux equivalents
sudo usermod -aG GROUP USER
sudo usermod -aG GROUP USER
sudo usermod -aG GROUP USER
Overview
What this command does
Adds an existing user to a supplementary group.
Migration tip: The
-a flag is essential: it appends the group instead of replacing all existing supplementary memberships.Practical tasks
Common use cases
Add a user to a group
Adds an existing user to a supplementary group.
sudo usermod -aG wheel alice
Add Alice to wheel
sudo usermod -aG docker alice
Add Alice to Docker group
groups alice
Verify memberships
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
sudo usermod -aG wheel alice
sudo usermod -aG docker alice
groups alice
Walkthrough
Examples with explanations
sudo usermod -aG wheel alice # add a user to wheel
sudo usermod -aG docker alice # add a user to the Docker group
groups alice # verify the result
Reference
Common options and variations
| Command or option | Use |
|---|---|
sudo usermod -aG wheel alice | Add Alice to wheel |
sudo usermod -aG docker alice | Add Alice to Docker group |
groups alice | Verify memberships |
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 | sudo usermod -aG GROUP USER |
Same command on this distribution. |
| Fedora | same command | sudo usermod -aG GROUP USER |
Same command on this distribution. |
| Arch | same command | sudo usermod -aG GROUP USER |
Same command on this distribution. |
Important
What to watch out for
Omitting -a can remove the user from other supplementary groups.
Keep learning