How can Ubuntu delete a user and directory?
To delete a user and their directory in Ubuntu, you can follow these steps:
- Log into the system with superuser’s permission (root).
- Use the following command to delete a user and their directory (replace “username” with the username to be deleted):
sudo userdel -r username
The -r option indicates that when deleting a user, their home directory will also be deleted.
- The system will prompt you to enter a password to confirm the deletion operation.
Please note that this action is irreversible, once deleted, users and their directories cannot be recovered, so please proceed with caution.