Using this command, we can manage and delete users that we no longer need. Here we will create a group of users and then delete it using the groupdel command.
How to Delete Groups with groupdel Command in Linux
To list all the groups run below-mentioned command:
Here we can see group1 displayed which we just created.
How to Delete a Group Using groupdel Command
Now to delete a specific group we will use the below-given command. For example, to delete the group1 from list run the groupdel command:
Once the group is deleting again, list all groups to confirm the deletion. Now again run the /etc/group command:
Here we can see the group1 is successfully removed using the groupdel command.
For example, if a certain group doesn’t delete, the “-f” flag will forcefully delete this group. To delete group1 using the “-f” flag, run the below command:
The grep command can also confirm whether a certain group is deleted or not.
If no output is displayed on the terminal, it means the group is already deleted.
For more info about groupdel run the given command:
Conclusion
The Linux “groupdel” command is a powerful tool for managing group accounts on a Linux system. It enables administrators to remove groups that are no longer needed, ensuring the security and efficiency of the system by reducing the number of unneeded access controls.