Linux Commands Reference - Complete Linux Command Guide

Comprehensive Linux command reference with 150+ commands. Search, filter by category, and view detailed usage examples.

Share
Back to commands

usermod

Modify user account properties

Syntax

usermod [OPTION]... USERNAME

Common Options

-lChange username
-dChange home directory
-sChange login shell
-gChange primary group
-GChange supplementary groups
-aGAppend to supplementary groups
-LLock account
-UUnlock account
-eSet expiry date
-cChange comment
-uChange user ID

Common Examples

usermod -aG docker username

Add user to docker group

usermod -s /bin/zsh username

Change user shell

usermod -l newname oldname

Rename user

usermod -L username

Lock user account

usermod -U username

Unlock user account

usermod -d /new/home -m username

Move home directory

usermod -e 2025-12-31 username

Set expiry date

usermod -G group1,group2 username

Set supplementary groups

Related Tools

More Code & Dev Tools