Windows PowerShell Add-LocalGroupMember equivalent in Linux
Adds an existing user to a supplementary group.
PowerShell Add-LocalGroupMember
sudo usermod -aG GROUP USER
sudo usermod -aG GROUP USER
sudo usermod -aG GROUP USER
Overview
What this command does
On Windows, "PowerShell Add-LocalGroupMember" is used to add a user to a group. On Linux, the closest practical mapping shown here is "sudo usermod -aG GROUP USER". Adds an existing user to a supplementary group. This reference is grouped under PowerShell Equivalents → Users & Groups.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows PowerShell Add-LocalGroupMember maps to sudo usermod -aG GROUP USER for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
Elevated privilege appears in this workflow
At least one example uses sudo. Confirm the target path, device, service or package before running the elevated form; do not add sudo simply to bypass an unexplained permission error.
Command-specific caution
Omitting -a can remove the user from other supplementary groups.
For the broader concept behind this mapping, read PowerShell vs Bash.
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
Debian/Ubuntu, Fedora and Arch all use "sudo usermod -aG GROUP USER" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| 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
Keep learning