Here are the steps to delete a user account on Ubuntu Linux:
-
Log in as root or use the
sudo
command to run the following commands with administrative privileges:sudo su
-
Use the
userdel
command to delete the user account. Replaceusername
with the actual username you want to delete:userdel username
-
By default, the user’s home directory and its contents are not deleted. To delete the home directory, use the following command:
rm -rf /home/username
-
To remove the user’s group, use the
groupdel
command:groupdel username
Note: Be careful when deleting user accounts and always make sure to backup important data before making changes.