Linux Basic Commands
7. useradd
useradd Command in Linux
The useradd command is used to create a new user on a Linux system.
It’s a simple and user-friendly command (more interactive than useradd).
🔹 Basic Syntax:
useradd [username]
🔹 Example:
useradd ashwin
👉 This will start an interactive setup like:
Adding user `ashwin` ...Adding new group `ashwin` (1001) ...Adding new user `ashwin` (1001) with group `ashwin` ...Creating home directory `/home/ashwin` ...Copying files from `/etc/skel` ...New password:Retype new password:Full Name []:Room Number []:Work Phone []:Home Phone []:Other []:Is the information correct? [Y/n]
🔹 What this does:
-
Creates a user account
ashwin -
Creates a home directory:
/home/ashwin -
Assigns a default group
-
Sets up a password
-
Adds user info (optional)
🔹 Verify the user was added:
id ashwin
or
cat /etc/passwd | grep ashwin
Try with Linux Practice