Reading Time: 2 minutes
According to the previous posts, we have created a user and a group to which we have added the user. You can see it in the following links:
First, we will remove the user DevCodeLight from the group. In the previous examples, we named it grupoDevCodeLight. To do this, we will use gpasswd.
Before that, if we view our group, the user DevCodeLight appears:
Then, with the following command, we remove that user from the group:
sudo gpasswd -d DevCodeLight grupoDevCodeLight
Once the command is entered in the console, the group appears without users as seen in the image below:
Next, we will delete the user and then the group with two simple commands.
Delete user along with their home directory
sudo userdel -r DevCodeLight
If we view the users, we will see that the user DevCodeLight has been deleted.
Delete group
sudo groupdel grupoDevCodeLight
If we view the groups, we will see that the group grupoDevCodeLight has been deleted.
I hope this helps you. Have a great day.