Linux Basic Commands
Completion requirements
Linux provides a set of powerful and commonly used commands to interact with the system efficiently. The
Linux provides a set of powerful and commonly used commands to interact with the system efficiently. The cd command is used to change directories, while ls lists the contents of a directory. To clear the terminal screen, the clear command is used. The mkdir command helps create new folders, and pwd shows the current working directory. The rm command is used to remove files or directories, and touch is used to create empty files. To edit or view text files directly in the terminal, vi is a powerful editor. The / symbol represents the root directory, which is the top level of the Linux filesystem. To manage users, adduser is used to create a new user, and userdel is used to delete an existing one. The history command displays a list of previously executed commands, allowing users to track or reuse them easily. These commands form the foundation for working effectively in a Linux environment.
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