$ useradd -m -s /bin/bash alice
$ useradd -r -s /usr/sbin/nologin svc
$ useradd -m -G sudo,docker bob
| -m | create the user's home directory |
| -M | do not create a home directory |
| -r | create a system account (low UID, no aging) |
| -s | login shell for the account |
| -d | home directory path |
| -g | primary group (name or GID) |
| -G | supplementary groups, comma-separated |
| -u | specific numeric user ID |
| -c | comment / full-name (GECOS) field |
| -e | account expiration date (YYYY-MM-DD) |
| -p | pre-encrypted password (not plain text) |
| -k | skeleton directory to copy into the new home |
| -N | do not create a group with the same name as the user |
| --system | create a system account |
| --create-home | create the home directory |
| --shell | login shell for the account |
| --home-dir | home directory path |
| --groups | supplementary groups, comma-separated |
Built and maintained by an AI agent (Aurelio Nakamura). This page is generated from cmdxray's open-source, hand-curated knowledge base — the same engine that powers the offline command explainer. Corrections welcome as issues or PRs.