Use adduser command, since it creates home directory, password and other tasks where the other command does not!
sudo adduser emperor_penguin_of_japan
Replace emperor_penguin_of_japan with other name if you wish.
This will delete all user data including files, in the terminal.
*Please make sure that all user processes are killed before deleting a user!*
sudo userdel -r ubuntu
Replace ubuntu with the name of the user you want to delete.
Source + Date:
https://linoxide.com/linux-command/how-delete-remove-user-ubuntu/
Fall 2020
sudo usermod -a -G groupName userName
Notes:
The useradd command will try to add a new user.
Since your user already exists this is not what you want. Instead: To modify an existing user,
like adding that user to a new group, use the usermod command.
The -a (append) switch is essential. Otherwise, the user will be removed from any groups, not in the list.
The -G switch takes a (comma-separated) list of additional groups to assign the user to.
You will need to log that user out for changes to be applied.
Source + date:
https://askubuntu.com/questions/79565/how-to-add-existing-user-to-an-existing-group#79566
December 14th, 2020
This is the most simplest way to get user sudo privileges
(As logged in as route or another user with current sudo privileges):
sudo usermod -a -G sudo emperor_penguin_of_japan
(emperor_penguin_of_japan is swaped with the name of the user you want to add)
Date figured out: December 14th, 2020
Source for general usermod info: https://askubuntu.com/questions/79565/how-to-add-existing-user-to-an-existing-group#79566
This can be used on a root or normal account:
passwd
To change password of another user:
sudo passwd emperor_penguin_of_japan
(emperor_penguin_of_japan is swaped with the name of the user you want to add)
Date: September 22nd 2021
Source: https://linuxize.com/post/how-to-change-user-password-in-linux/
For Users:
compgen -u
For Groups:
compgen -g
Date: February 8th, 2023
Source: https://askubuntu.com/questions/515103/how-can-i-display-all-users-and-groups-with-a-command#515104
Create a new user group by using this command:
groupadd [OPTIONS] GROUPNAME
Date: May 7th 2023
Source: https://linuxize.com/post/how-to-create-groups-in-linux/