useradd

Create a new user or update default new user information. By default the new user will have no password; to provide a password use the passwd command along with the username,

Syntax: useradd [option] username

Example: Creating a user named mark. We provide a default home directory for the user (-m) and assign the default shell (-s) .

$ sudo useradd mark -m -s /bin/bash

userdel

Delete a user account and related files.

Syntax: userdel [option] username

Options:

  1. Use the -r or --remove option to delete the files in the user's home directory and the home directory itself.
  2. User -f or --force to force remove a user. It deletes all the user's files in the home directory and the home directory itself.

groups

Print the grops a user is in.

Syntax: groups [option] username

Example:

$ groups shathin
shathin : shathin adm dialout cdrom floppy sudo audio dip video plugdev netdev

<aside> 💡 Use cat /etc/group command to list all the groups in the linux system.

</aside>


groupadd

Create a new group.