The command below will add a new user to a Linux system, create their home directory at /home/newuser
and set the default shell to /bin/bash
.
sudo useradd -m -s /bin/bash newuser
The command below set the password for the new user.
sudo passwd newuser
The command below will delete a user without deleting their home directory.
sudo userdel newuser
To delete the home directory as well.
sudo userdel --remove newuser
To login as a newly created user
sudo -u newuser bash
sudo usermod -a -G groupname newuser