When working on the command line, you should use the adduser command to create a new user or add a user to an existing group. To add a user with the adduser command, use this format:
sudo adduser --home /home/rich rich
This command creates the new user account, rich, and creates a home folder at /home/ rich for the account.
You can also use the adduser command to add an existing user account to a group:
sudo adduser rich users This command adds the username rich to the users group. The deluser command deletes a user account from the system:
sudo deluser rich
By default, the deluser command doesn't remove the home folder of the user. To do that, you need to add the - -remove-home parameter:
sudo deluser --remove-home rich
Similar to the adduser command, you can use the deluser command to remove a username from a group:
sudo deluser rich users
These two commands give you complete control over user accounts from the command line, but there are more commands for controlling groups, discussed next.
Was this article helpful?